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
d381519b
Commit
d381519b
authored
Nov 25, 2014
by
Kevin Luo
Committed by
Zia Fazal
Apr 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add compare-branch option to paver run_quality
parent
0acc262b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
pavelib/quality.py
+13
-3
No files found.
pavelib/quality.py
View file @
d381519b
...
...
@@ -126,14 +126,16 @@ def _count_pep8_violations(report_file):
@task
@needs
(
'pavelib.prereqs.install_python_prereqs'
)
@cmdopts
([
(
"compare-branch="
,
"b"
,
"Branch to compare against, defaults to origin/master"
),
(
"percentage="
,
"p"
,
"fail if diff-quality is below this percentage"
),
])
def
run_quality
(
options
):
"""
Build the html diff quality reports, and print the reports to the console.
:param: b, the branch to compare against, defaults to origin/master
:param: p, diff-quality will fail if the quality percentage calculated is
below this percentage. For example, if p is set to 80, and diff-quality finds
quality of the branch vs
master
is less than 80
%
, then this task will fail.
quality of the branch vs
the compare branch
is less than 80
%
, then this task will fail.
This threshold would be applied to both pep8 and pylint.
"""
...
...
@@ -142,6 +144,12 @@ def run_quality(options):
dquality_dir
=
(
Env
.
REPORT_DIR
/
"diff_quality"
)
.
makedirs_p
()
diff_quality_percentage_failure
=
False
# Set the string, if needed, to be used for the diff-quality --compare-branch switch.
compare_branch
=
getattr
(
options
,
'compare_branch'
,
None
)
compare_branch_string
=
''
if
compare_branch
:
compare_branch_string
=
'--compare-branch={0}'
.
format
(
compare_branch
)
# Set the string, if needed, to be used for the diff-quality --fail-under switch.
diff_threshold
=
int
(
getattr
(
options
,
'percentage'
,
-
1
))
percentage_string
=
''
...
...
@@ -158,9 +166,10 @@ def run_quality(options):
try
:
sh
(
"diff-quality --violations=pep8 {pep8_reports} {percentage_string} "
"--html-report {dquality_dir}/diff_quality_pep8.html"
.
format
(
"
{compare_branch_string}
--html-report {dquality_dir}/diff_quality_pep8.html"
.
format
(
pep8_reports
=
pep8_reports
,
percentage_string
=
percentage_string
,
compare_branch_string
=
compare_branch_string
,
dquality_dir
=
dquality_dir
)
)
...
...
@@ -185,12 +194,13 @@ def run_quality(options):
try
:
sh
(
"{pythonpath_prefix} diff-quality --violations=pylint "
"{pylint_reports} {percentage_string} "
"{pylint_reports} {percentage_string}
{compare_branch_string}
"
"--html-report {dquality_dir}/diff_quality_pylint.html "
"--options='{pylint_options}'"
.
format
(
pythonpath_prefix
=
pythonpath_prefix
,
pylint_reports
=
pylint_reports
,
percentage_string
=
percentage_string
,
compare_branch_string
=
compare_branch_string
,
dquality_dir
=
dquality_dir
,
pylint_options
=
"--disable=fixme"
,
)
...
...
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