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
816817bf
Commit
816817bf
authored
9 years ago
by
Raniere Silva
Browse files
Options
Downloads
Plain Diff
Merge pull request #232 from r-gaia-cs/core-summarize
Implement counter of errors at tools/check.py output
parents
4fce8aea
ff6703f6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/check.py
+17
-4
17 additions, 4 deletions
tools/check.py
with
17 additions
and
4 deletions
tools/check.py
+
17
−
4
View file @
816817bf
...
...
@@ -13,6 +13,7 @@ Call at command line with flag -h to see options and usage instructions.
import
argparse
import
collections
import
functools
import
glob
import
hashlib
import
logging
...
...
@@ -25,6 +26,19 @@ import yaml
import
validation_helpers
as
vh
NUMBER_OF_ERRORS
=
0
def
incr_error
(
func
):
"""
Wrapper to count the number of errors
"""
@functools.wraps
(
func
)
def
wrapper
(
*
args
,
**
kwargs
):
global
NUMBER_OF_ERRORS
NUMBER_OF_ERRORS
+=
1
return
func
(
*
args
,
**
kwargs
)
return
wrapper
logging
.
error
=
incr_error
(
logging
.
error
)
class
MarkdownValidator
(
object
):
"""
Base class for Markdown validation
...
...
@@ -822,12 +836,11 @@ def main(parsed_args_obj):
if
all_valid
is
True
:
logging
.
debug
(
"
All Markdown files successfully passed validation.
"
)
sys
.
exit
(
0
)
else
:
logging
.
warning
(
"
Some
errors were encountered during validation.
"
"
See log for details.
"
)
sys
.
exit
(
1
)
"
{0}
errors were encountered during validation.
"
"
See log for details.
"
.
format
(
NUMBER_OF_ERRORS
)
)
sys
.
exit
(
NUMBER_OF_ERRORS
)
if
__name__
==
"
__main__
"
:
...
...
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