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
28a3e9f5
Commit
28a3e9f5
authored
Mar 02, 2015
by
Ben Patterson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7178 from edx/benp/make-pep8-output-easier
Make pep8 failure output easier to understand.
parents
ecbfe5c9
ff2dd934
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
pavelib/quality.py
+17
-16
scripts/all-tests.sh
+1
-2
No files found.
pavelib/quality.py
View file @
28a3e9f5
...
...
@@ -143,31 +143,32 @@ def _count_pylint_violations(report_file):
@needs
(
'pavelib.prereqs.install_python_prereqs'
)
@cmdopts
([
(
"system="
,
"s"
,
"System to act on"
),
(
"limit="
,
"l"
,
"limit for number of acceptable violations"
),
])
def
run_pep8
(
options
):
"""
Run pep8 on system code.
When violations limit is passed in,
fail the task if too m
any violations are found.
Run pep8 on system code.
Fail the task if
any violations are found.
"""
num_violations
=
0
systems
=
getattr
(
options
,
'system'
,
ALL_SYSTEMS
)
.
split
(
','
)
violations_limit
=
int
(
getattr
(
options
,
'limit'
,
-
1
))
report_dir
=
(
Env
.
REPORT_DIR
/
'pep8'
)
report_dir
.
rmtree
(
ignore_errors
=
True
)
report_dir
.
makedirs_p
()
for
system
in
systems
:
# Directory to put the pep8 report in.
# This makes the folder if it doesn't already exist.
report_dir
=
(
Env
.
REPORT_DIR
/
system
)
.
makedirs_p
()
sh
(
'pep8 {system} | tee {report_dir}/pep8.report -a'
.
format
(
system
=
system
,
report_dir
=
report_dir
))
sh
(
'pep8 {system} | tee {report_dir}/pep8.report'
.
format
(
system
=
system
,
report_dir
=
report_dir
))
num_violations
=
num_violations
+
_count_pep8_violations
(
"{report_dir}/pep8.report"
.
format
(
report_dir
=
report_dir
)
)
count
=
_count_pep8_violations
(
"{report_dir}/pep8.report"
.
format
(
report_dir
=
report_dir
)
)
print
(
"Number of pep8 violations: "
+
str
(
num_violations
))
# Fail the task if the violations limit has been reached
if
num_violations
>
violations_limit
>
-
1
:
raise
Exception
(
"Failed. Too many pep8 violations. "
"The limit is {violations_limit}."
.
format
(
violations_limit
=
violations_limit
))
print
(
"Number of pep8 violations: {count}"
.
format
(
count
=
count
))
if
count
:
raise
Exception
(
"Too many pep8 violations. Number of violations found: {count}."
.
format
(
count
=
count
)
)
def
_count_pep8_violations
(
report_file
):
...
...
scripts/all-tests.sh
View file @
28a3e9f5
...
...
@@ -62,7 +62,6 @@ source scripts/jenkins-common.sh
# Violations thresholds for failing the build
PYLINT_THRESHOLD
=
6000
PEP8_THRESHOLD
=
0
# If the environment variable 'SHARD' is not set, default to 'all'.
# This could happen if you are trying to use this script from
...
...
@@ -75,7 +74,7 @@ case "$TEST_SUITE" in
"quality"
)
paver find_fixme
>
fixme.log
||
{
cat
fixme.log
;
EXIT
=
1
;
}
paver run_pep8
-l
$PEP8_THRESHOLD
>
pep8.log
||
{
cat
pep8.log
;
EXIT
=
1
;
}
paver run_pep8
>
pep8.log
||
{
cat
pep8.log
;
EXIT
=
1
;
}
paver run_pylint
-l
$PYLINT_THRESHOLD
>
pylint.log
||
{
cat
pylint.log
;
EXIT
=
1
;
}
# Run quality task. Pass in the 'fail-under' percentage to diff-quality
paver run_quality
-p
100
...
...
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