Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
noms-de-domaine-organismes-secteur-public
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Palard
noms-de-domaine-organismes-secteur-public
Commits
7ea8b4f3
Unverified
Commit
7ea8b4f3
authored
1 year ago
by
Julien Palard
Browse files
Options
Downloads
Patches
Plain Diff
check.py: exit non-zero on failure and properly parse CSV.
parent
d448dd0e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#64056
passed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/check.py
+10
-5
10 additions, 5 deletions
scripts/check.py
with
10 additions
and
5 deletions
scripts/check.py
+
10
−
5
View file @
7ea8b4f3
...
...
@@ -6,16 +6,20 @@
- Are all domains in domains.csv proper domain names?
"""
import
csv
import
sys
from
functools
import
cached_property
from
pathlib
import
Path
import
validators
from
public_domain
import
Domain
,
parse_files
nb_errors
=
0
def
err
(
*
args
,
**
kwargs
):
global
nb_errors
nb_errors
+=
1
kwargs
[
"
file
"
]
=
sys
.
stderr
print
(
*
args
,
**
kwargs
)
...
...
@@ -84,10 +88,10 @@ class DuplicateChecker:
def
main
():
check_duplicate_line
=
DuplicateChecker
()
lines
=
[
line
.
split
(
"
,
"
)[
0
]
for
line
in
Path
(
"
domains.csv
"
).
read_text
(
encoding
=
"
UTF-8
"
).
splitlines
()[
1
:]
]
with
open
(
"
domains.csv
"
,
encoding
=
"
UTF-8
"
)
as
domainsfile
:
domainsreader
=
csv
.
reader
(
domainsfile
)
next
(
domainsreader
)
# Skip header
lines
=
[
row
[
0
]
for
row
in
domainsreader
]
check_is_sorted
(
"
domains.csv
"
,
lines
)
for
lineno
,
line
in
enumerate
(
lines
,
start
=
2
):
check_is_valid_domain
(
"
domains.csv
"
,
lineno
,
line
)
...
...
@@ -101,3 +105,4 @@ def main():
if
__name__
==
"
__main__
"
:
main
()
sys
.
exit
(
bool
(
nb_errors
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment