Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
public-apis
Commits
10bc3049
Commit
10bc3049
authored
Jul 28, 2017
by
Dave Machado
Browse files
exit code is num of errors and formatting
parent
ffddb7bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
build/validate_format.rb
View file @
10bc3049
...
...
@@ -26,7 +26,7 @@ def add_error(line_num, val_index, message)
segment
=
"Link"
end
$errors
.
push
(
"(L%03d)
(
#{
segment
}
)
#{
message
}
"
%
line_num
)
$errors
.
push
(
"(L%03d)
%-14.14s
#{
message
}
"
%
[
line_num
,
segment
]
)
end
File
.
foreach
(
filename
).
with_index
do
|
line
,
line_num
|
...
...
@@ -44,7 +44,7 @@ File.foreach(filename).with_index do | line, line_num |
case
val_index
when
INDEX_TITLE
..
INDEX_LINK
if
val
[
0
]
!=
" "
||
val
[
val
.
length
-
1
]
!=
" "
add_error
(
line_num
,
val_index
,
"
spacing is invalid (
pad before and after string
)
"
)
add_error
(
line_num
,
val_index
,
"pad before and after string
with spaces
"
)
end
end
end
...
...
@@ -80,11 +80,7 @@ File.foreach(filename).with_index do | line, line_num |
end
end
end
if
$errors
.
length
>
0
$errors
.
each
do
|
e
|
puts
e
end
exit
(
1
)
else
exit
(
0
)
$errors
.
each
do
|
e
|
puts
e
end
exit
(
$errors
.
length
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment