Commit 1d005086 by Ben Patterson

Merge pull request #7147 from edx/benp/static-code-analysis-radon

Benp/static code analysis radon
parents a70cabc1 eb4f8529
......@@ -200,6 +200,25 @@ def _count_pep8_violations(report_file):
@task
@needs('pavelib.prereqs.install_python_prereqs')
def run_complexity():
"""
Uses radon to examine cyclomatic complexity.
For additional details on radon, see http://radon.readthedocs.org/
"""
system_string = 'cms/ lms/ common/ openedx/'
print "--> Calculating cyclomatic complexity of files..."
try:
sh(
"radon cc {system_string} --total-average".format(
system_string=system_string
)
)
except BuildFailure:
print "ERROR: Unable to calculate python-only code-complexity."
@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"),
......
......@@ -142,6 +142,7 @@ pep8==1.5.7
PyContracts==1.7.1
pylint==1.4.1
python-subunit==0.0.16
radon==1.2
rednose==0.3
selenium==2.42.1
splinter==0.5.4
......
......@@ -79,9 +79,10 @@ case "$TEST_SUITE" in
# Run quality task. Pass in the 'fail-under' percentage to diff-quality
paver run_quality -p 100
mkdir -p reports
paver run_complexity > reports/code_complexity.log || echo "Unable to calculate code complexity. Ignoring error."
# Need to create an empty test result so the post-build
# action doesn't fail the build.
mkdir -p reports
cat > reports/quality.xml <<END
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="quality" tests="1" errors="0" failures="0" skip="0">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment