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
7376b114
Commit
7376b114
authored
May 03, 2017
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't re-run pylint or pep8 when generating diffquality reports
parent
8c35e3d8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
pavelib/quality.py
+13
-11
No files found.
pavelib/quality.py
View file @
7376b114
...
...
@@ -74,7 +74,7 @@ def find_fixme(options):
print
"Number of pylint fixmes: "
+
str
(
num_fixme
)
def
_get_pylint_violations
(
systems
=
ALL_SYSTEMS
.
split
(
','
),
errors_only
=
False
):
def
_get_pylint_violations
(
systems
=
ALL_SYSTEMS
.
split
(
','
),
errors_only
=
False
,
clean
=
True
):
"""
Runs pylint. Returns a tuple of (number_of_violations, list_of_violations)
where list_of_violations is a list of all pylint violations found, separated
...
...
@@ -97,6 +97,8 @@ def _get_pylint_violations(systems=ALL_SYSTEMS.split(','), errors_only=False):
apps_list
=
' '
.
join
(
top_python_dirs
(
system
))
system_report
=
report_dir
/
'pylint.report'
if
clean
or
not
system_report
.
exists
():
sh
(
"pylint {flags} --output-format=parseable {apps} "
"> {report_dir}/pylint.report"
.
format
(
...
...
@@ -107,9 +109,8 @@ def _get_pylint_violations(systems=ALL_SYSTEMS.split(','), errors_only=False):
ignore_error
=
True
,
)
report
=
"{report_dir}/pylint.report"
.
format
(
report_dir
=
report_dir
)
num_violations
+=
_count_pylint_violations
(
report
)
with
open
(
report
)
as
report_contents
:
num_violations
+=
_count_pylint_violations
(
system_report
)
with
open
(
system_report
)
as
report_contents
:
violations_list
.
extend
(
report_contents
)
# Print number of violations to log
...
...
@@ -203,24 +204,25 @@ def _count_pylint_violations(report_file):
return
num_violations_report
def
_get_pep8_violations
():
def
_get_pep8_violations
(
clean
=
True
):
"""
Runs pep8. Returns a tuple of (number_of_violations, violations_string)
where violations_string is a string of all pep8 violations found, separated
by new lines.
"""
report_dir
=
(
Env
.
REPORT_DIR
/
'pep8'
)
if
clean
:
report_dir
.
rmtree
(
ignore_errors
=
True
)
report_dir
.
makedirs_p
()
report
=
report_dir
/
'pep8.report'
# Make sure the metrics subdirectory exists
Env
.
METRICS_DIR
.
makedirs_p
()
sh
(
'pep8 . | tee {report_dir}/pep8.report -a'
.
format
(
report_dir
=
report_dir
))
if
not
report
.
exists
():
sh
(
'pep8 . | tee {} -a'
.
format
(
report
))
violations_list
=
_pep8_violations
(
"{report_dir}/pep8.report"
.
format
(
report_dir
=
report_dir
)
)
violations_list
=
_pep8_violations
(
report
)
return
(
len
(
violations_list
),
violations_list
)
...
...
@@ -737,7 +739,7 @@ def run_quality(options):
return
''
.
join
(
lines
)
# Run pep8 directly since we have 0 violations on master
(
count
,
violations_list
)
=
_get_pep8_violations
()
(
count
,
violations_list
)
=
_get_pep8_violations
(
clean
=
False
)
# Print number of violations to log
print
_lint_output
(
'pep8'
,
count
,
violations_list
)
...
...
@@ -753,7 +755,7 @@ def run_quality(options):
# If pylint reports exist, use those
# Otherwise, `diff-quality` will call pylint itself
(
count
,
violations_list
)
=
_get_pylint_violations
()
(
count
,
violations_list
)
=
_get_pylint_violations
(
clean
=
False
)
# Print number of violations to log
print
_lint_output
(
'pylint'
,
count
,
violations_list
,
limit
=
6100
)
...
...
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