Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lesson Template
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
prace-lessons
Lesson Template
Commits
c89124ef
Commit
c89124ef
authored
10 years ago
by
Andy Boughton
Browse files
Options
Downloads
Patches
Plain Diff
Support multiple directories specified at command line
parent
7e40a6ed
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/check.py
+10
-6
10 additions, 6 deletions
tools/check.py
with
10 additions
and
6 deletions
tools/check.py
+
10
−
6
View file @
c89124ef
...
...
@@ -667,6 +667,7 @@ def command_line():
return
parser
.
parse_args
()
def
check_required_files
(
dir_to_validate
):
"""
Check if required files exists.
"""
REQUIRED_FILES
=
[
"
01-*.md
"
,
...
...
@@ -688,16 +689,17 @@ def check_required_files(dir_to_validate):
return
valid
def
get_files_to_validate
(
file_or_path
):
"""
Generate list of files to validate.
"""
files_to_validate
=
[]
dir_to_validate
=
None
dir
s
_to_validate
=
[]
for
fn
in
file_or_path
:
if
os
.
path
.
isdir
(
fn
):
search_str
=
os
.
path
.
join
(
fn
,
"
*.md
"
)
files_to_validate
.
extend
(
glob
.
glob
(
search_str
))
dir_to_validate
=
fn
dir
s
_to_validate
.
append
(
fn
)
elif
os
.
path
.
isfile
(
fn
):
files_to_validate
.
append
(
fn
)
else
:
...
...
@@ -705,7 +707,8 @@ def get_files_to_validate(file_or_path):
"
The specified file or folder {0} does not exist;
"
"
could not perform validation
"
.
format
(
fn
))
return
files_to_validate
,
dir_to_validate
return
files_to_validate
,
dirs_to_validate
def
main
(
parsed_args_obj
):
if
parsed_args_obj
.
debug
:
...
...
@@ -718,11 +721,12 @@ def main(parsed_args_obj):
all_valid
=
True
files_to_validate
,
dir_to_validate
=
get_files_to_validate
(
parsed_args_obj
.
file_or_path
)
files_to_validate
,
dirs_to_validate
=
get_files_to_validate
(
parsed_args_obj
.
file_or_path
)
# If user ask to validate only one file don't check for required files.
i
f
dir_to_validate
:
all_valid
=
all_valid
and
check_required_files
(
d
ir_to_validate
)
f
or
d
in
dir
s
_to_validate
:
all_valid
=
all_valid
and
check_required_files
(
d
)
for
fn
in
files_to_validate
:
res
=
validate_single
(
fn
,
template
=
template
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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