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
3a79096b
"jshERP-boot/vscode:/vscode.git/clone" did not exist on "0d86ce1e83f2b75ccdee0ccbfd072a7b60c9482f"
Commit
3a79096b
authored
Jul 28, 2017
by
Dave Machado
Browse files
use regex to check number of padding spaces
parent
10bc3049
Changes
2
Show whitespace changes
Inline
Side-by-side
build/test.rb
0 → 100644
View file @
3a79096b
s
=
" lol "
puts
s
[
/\A +/
].
size
puts
s
[
/ +\z/
].
size
\ No newline at end of file
build/validate_format.rb
View file @
3a79096b
...
@@ -39,16 +39,17 @@ File.foreach(filename).with_index do | line, line_num |
...
@@ -39,16 +39,17 @@ File.foreach(filename).with_index do | line, line_num |
values
=
line
.
split
(
"|"
)
values
=
line
.
split
(
"|"
)
################### GLOBAL ###################
values
.
each
.
with_index
do
|
val
,
val_index
|
values
.
each
.
with_index
do
|
val
,
val_index
|
msg
=
""
msg
=
""
case
val_index
case
val_index
when
INDEX_TITLE
..
INDEX_LINK
when
INDEX_TITLE
..
INDEX_LINK
if
val
[
0
]
!=
" "
||
val
[
val
.
length
-
1
]
!=
" "
# every line segment should start and end with exactly 1 space
add_error
(
line_num
,
val_index
,
"pad before and after string with spaces"
)
if
val
[
/\A */
].
size
!=
1
||
val
[
/ *\z/
].
size
!=
1
add_error
(
line_num
,
val_index
,
"string should start and end with exactly 1 space"
)
end
end
end
end
end
end
################# DESCRIPTION ################
################# DESCRIPTION ################
# First character should be capitalized
# First character should be capitalized
desc_val
=
values
[
INDEX_DESCRIPTION
].
lstrip
.
chop
desc_val
=
values
[
INDEX_DESCRIPTION
].
lstrip
.
chop
...
...
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