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
2f4a80bf
Commit
2f4a80bf
authored
May 06, 2018
by
davemachado
Browse files
Add check for duplicate links
parent
466f5e89
Changes
1
Hide whitespace changes
Inline
Side-by-side
build/validate_format.py
View file @
2f4a80bf
...
@@ -20,6 +20,7 @@ num_segments = 6
...
@@ -20,6 +20,7 @@ num_segments = 6
errors
=
[]
errors
=
[]
title_links
=
[]
title_links
=
[]
previous_links
=
[]
anchor_re
=
re
.
compile
(
anchor
+
'\s(.+)'
)
anchor_re
=
re
.
compile
(
anchor
+
'\s(.+)'
)
section_title_re
=
re
.
compile
(
'\*\s\[(.*)\]'
)
section_title_re
=
re
.
compile
(
'\*\s\[(.*)\]'
)
...
@@ -96,6 +97,10 @@ def check_entry(line_num, segments):
...
@@ -96,6 +97,10 @@ def check_entry(line_num, segments):
link
=
segments
[
index_link
]
link
=
segments
[
index_link
]
if
not
link
.
startswith
(
'[Go!](http'
)
or
not
link
.
endswith
(
')'
):
if
not
link
.
startswith
(
'[Go!](http'
)
or
not
link
.
endswith
(
')'
):
add_error
(
line_num
,
'link syntax should be "[Go!](LINK)"'
)
add_error
(
line_num
,
'link syntax should be "[Go!](LINK)"'
)
if
link
in
previous_links
:
add_error
(
line_num
,
'duplicate link - entries should only be included in one section'
)
else
:
previous_links
.
append
(
link
)
# END Link
# END Link
...
...
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