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
b756f21f
Unverified
Commit
b756f21f
authored
Apr 21, 2018
by
Dave Machado
Committed by
GitHub
Apr 21, 2018
Browse files
Add segment length check per entry
This avoids an IndexError if the length of split segments is shorter than expected.
parent
9bdfc79c
Changes
1
Hide whitespace changes
Inline
Side-by-side
build/validate_format.py
View file @
b756f21f
...
@@ -16,6 +16,7 @@ index_auth = 2
...
@@ -16,6 +16,7 @@ index_auth = 2
index_https
=
3
index_https
=
3
index_cors
=
4
index_cors
=
4
index_link
=
5
index_link
=
5
num_segments
=
6
errors
=
[]
errors
=
[]
title_links
=
[]
title_links
=
[]
...
@@ -133,6 +134,10 @@ def check_format(filename):
...
@@ -133,6 +134,10 @@ def check_format(filename):
continue
continue
num_in_category
+=
1
num_in_category
+=
1
segments
=
line
.
split
(
'|'
)[
1
:
-
1
]
segments
=
line
.
split
(
'|'
)[
1
:
-
1
]
if
len
(
segments
)
<
num_segments
:
add_error
(
line_num
,
"entry does not have all the required sections (have {}, need {})"
.
format
(
len
(
segments
),
num_segments
))
continue
# START Global
# START Global
for
segment
in
segments
:
for
segment
in
segments
:
# every line segment should start and end with exactly 1 space
# every line segment should start and end with exactly 1 space
...
...
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