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
d578ba7a
Unverified
Commit
d578ba7a
authored
Jan 16, 2022
by
Matheus Felipe
Browse files
Change line -> line_content
parent
a935a05d
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/validate/format.py
View file @
d578ba7a
...
...
@@ -193,15 +193,15 @@ def check_file_format(filename: str) -> None:
category
=
''
category_line
=
0
for
line_num
,
line
in
enumerate
(
lines
):
for
line_num
,
line
_content
in
enumerate
(
lines
):
category_title_match
=
category_title_in_index_re
.
match
(
line
)
category_title_match
=
category_title_in_index_re
.
match
(
line
_content
)
if
category_title_match
:
title_links
.
append
(
category_title_match
.
group
(
1
))
# check each category for the minimum number of entries
if
line
.
startswith
(
anchor
):
category_match
=
anchor_re
.
match
(
line
)
if
line
_content
.
startswith
(
anchor
):
category_match
=
anchor_re
.
match
(
line
_content
)
if
category_match
:
if
category_match
.
group
(
1
)
not
in
title_links
:
message
=
error_message
(
line_num
,
f
'category header (
{
category_match
.
group
(
1
)
}
) not added to Index section'
)
...
...
@@ -214,17 +214,17 @@ def check_file_format(filename: str) -> None:
message
=
error_message
(
category_line
,
f
'
{
category
}
category does not have the minimum
{
min_entries_per_section
}
entries (only has
{
num_in_category
}
)'
)
errors
.
append
(
message
)
category
=
line
.
split
(
' '
)[
1
]
category
=
line
_content
.
split
(
' '
)[
1
]
category_line
=
line_num
num_in_category
=
0
continue
# skips lines that we do not care about
if
not
line
.
startswith
(
'|'
)
or
line
.
startswith
(
'|---'
):
if
not
line
_content
.
startswith
(
'|'
)
or
line
_content
.
startswith
(
'|---'
):
continue
num_in_category
+=
1
segments
=
line
.
split
(
'|'
)[
1
:
-
1
]
segments
=
line
_content
.
split
(
'|'
)[
1
:
-
1
]
if
len
(
segments
)
<
num_segments
:
message
=
error_message
(
line_num
,
f
'entry does not have all the required sections (have
{
len
(
segments
)
}
, need
{
num_segments
}
)'
)
errors
.
append
(
message
)
...
...
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