Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions pavelib/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,25 @@ def _count_pep8_violations(report_file):
return num_lines


@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([
Expand Down
1 change: 1 addition & 0 deletions requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ pep8==1.5.7
PyContracts==1.7.1
pylint==1.4.1
python-subunit==0.0.16
radon==1.2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a thumbsup from devops for adding a new python dependency.

rednose==0.3
selenium==2.42.1
splinter==0.5.4
Expand Down
3 changes: 2 additions & 1 deletion scripts/all-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,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">
Expand Down