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
9722487f
Commit
9722487f
authored
Mar 21, 2021
by
Marek Dano
Browse files
Add ignore link and strip url links before checking it
parent
97cb773f
Changes
1
Show whitespace changes
Inline
Side-by-side
build/validate_links.py
View file @
9722487f
...
...
@@ -9,6 +9,7 @@ ignored_links = [
'https://github.com/public-apis/public-apis/actions?query=workflow%3A%22Run+tests%22'
,
'https://github.com/public-apis/public-apis/workflows/Validate%20links/badge.svg?branch=master'
,
'https://github.com/public-apis/public-apis/actions?query=workflow%3A%22Validate+links%22'
,
'https://github.com/davemachado/public-api'
,
]
def
parse_links
(
filename
):
...
...
@@ -28,20 +29,21 @@ def dup_links(links):
seen
=
{}
dupes
=
[]
for
x
in
links
:
if
x
in
ignored_links
:
for
link
in
links
:
link
=
link
.
rstrip
(
'/'
)
if
link
in
ignored_links
:
continue
if
x
not
in
seen
:
seen
[
x
]
=
1
if
link
not
in
seen
:
seen
[
link
]
=
1
else
:
if
seen
[
x
]
==
1
:
dupes
.
append
(
x
)
if
seen
[
link
]
==
1
:
dupes
.
append
(
link
)
if
not
dupes
:
print
(
f
"No duplicate
d
links"
)
print
(
f
"No duplicate links"
)
else
:
print
(
f
"Found duplicate
d
links:
{
dupes
}
"
)
print
(
f
"Found duplicate links:
{
dupes
}
"
)
hasError
=
True
return
hasError
...
...
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