Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
8919d3f8
Commit
8919d3f8
authored
Mar 03, 2015
by
Christine Lytwynec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store count of pep8 and pylint violations to files in reports dir
parent
006b06dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
pavelib/quality.py
+24
-2
pavelib/utils/envs.py
+1
-0
No files found.
pavelib/quality.py
View file @
8919d3f8
...
...
@@ -75,6 +75,9 @@ def run_pylint(options):
violations_limit
=
int
(
getattr
(
options
,
'limit'
,
-
1
))
errors
=
getattr
(
options
,
'errors'
,
False
)
systems
=
getattr
(
options
,
'system'
,
ALL_SYSTEMS
)
.
split
(
','
)
# Make sure the metrics subdirectory exists
Env
.
METRICS_DIR
.
makedirs_p
()
for
system
in
systems
:
# Directory to put the pylint report in.
...
...
@@ -114,7 +117,15 @@ def run_pylint(options):
num_violations
+=
_count_pylint_violations
(
"{report_dir}/pylint.report"
.
format
(
report_dir
=
report_dir
))
print
(
"Number of pylint violations: "
+
str
(
num_violations
))
# Print number of violations to log
violations_count_str
=
"Number of pylint violations: "
+
str
(
num_violations
)
print
(
violations_count_str
)
# Also write the number of violations to a file
with
open
(
Env
.
METRICS_DIR
/
"pylint"
,
"w"
)
as
f
:
f
.
write
(
violations_count_str
)
# Fail number of violations is greater than the limit
if
num_violations
>
violations_limit
>
-
1
:
raise
Exception
(
"Failed. Too many pylint violations. "
"The limit is {violations_limit}."
.
format
(
violations_limit
=
violations_limit
))
...
...
@@ -154,6 +165,9 @@ def run_pep8(options):
report_dir
=
(
Env
.
REPORT_DIR
/
'pep8'
)
report_dir
.
rmtree
(
ignore_errors
=
True
)
report_dir
.
makedirs_p
()
# Make sure the metrics subdirectory exists
Env
.
METRICS_DIR
.
makedirs_p
()
for
system
in
systems
:
sh
(
'pep8 {system} | tee {report_dir}/pep8.report -a'
.
format
(
system
=
system
,
report_dir
=
report_dir
))
...
...
@@ -162,7 +176,15 @@ def run_pep8(options):
"{report_dir}/pep8.report"
.
format
(
report_dir
=
report_dir
)
)
print
(
"Number of pep8 violations: {count}"
.
format
(
count
=
count
))
# Print number of violations to log
violations_count_str
=
"Number of pep8 violations: {count}"
.
format
(
count
=
count
)
print
(
violations_count_str
)
# Also write the number of violations to a file
with
open
(
Env
.
METRICS_DIR
/
"pep8"
,
"w"
)
as
f
:
f
.
write
(
violations_count_str
)
# Fail if any violations are found
if
count
:
raise
Exception
(
"Too many pep8 violations. Number of violations found: {count}."
.
format
(
...
...
pavelib/utils/envs.py
View file @
8919d3f8
...
...
@@ -20,6 +20,7 @@ class Env(object):
# Reports Directory
REPORT_DIR
=
REPO_ROOT
/
'reports'
METRICS_DIR
=
REPORT_DIR
/
'metrics'
# Bok_choy dirs
BOK_CHOY_DIR
=
REPO_ROOT
/
"common"
/
"test"
/
"acceptance"
...
...
Write
Preview
Markdown
is supported
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