Skip to content

Commit

Permalink
add find_fixme task
Browse files Browse the repository at this point in the history
  • Loading branch information
Christine Lytwynec committed Dec 10, 2014
1 parent f561e79 commit 7f23c88
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions pavelib/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,53 @@
from .utils.envs import Env


@task
@needs('pavelib.prereqs.install_python_prereqs')
@cmdopts([
("system=", "s", "System to act on"),
])
def find_fixme(options):
"""
Run pylint on system code, only looking for fixme items.
"""
num_fixme = 0
systems = getattr(options, 'system', 'lms,cms,common').split(',')

for system in systems:
# Directory to put the pylint report in.
# This makes the folder if it doesn't already exist.
report_dir = (Env.REPORT_DIR / system).makedirs_p()

apps = [system]

for directory in ['djangoapps', 'lib']:
dirs = os.listdir(os.path.join(system, directory))
apps.extend([d for d in dirs if os.path.isdir(os.path.join(system, directory, d))])

apps_list = ' '.join(apps)

pythonpath_prefix = (
"PYTHONPATH={system}:{system}/djangoapps:{system}/"
"lib:common/djangoapps:common/lib".format(
system=system
)
)

sh(
"{pythonpath_prefix} pylint --disable R,C,W,E --enable=fixme "
"-f parseable {apps} | tee {report_dir}/pylint_fixme.report".format(
pythonpath_prefix=pythonpath_prefix,
apps=apps_list,
report_dir=report_dir
)
)

num_fixme += _count_pylint_violations(
"{report_dir}/pylint_fixme.report".format(report_dir=report_dir))

print("Number of pylint fixmes: " + str(num_fixme))


@task
@needs('pavelib.prereqs.install_python_prereqs')
@cmdopts([
Expand Down
1 change: 1 addition & 0 deletions scripts/all-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ SHARD=${SHARD:="all"}
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_pylint -l $PYLINT_THRESHOLD > pylint.log || { cat pylint.log; EXIT=1; }
# Run quality task. Pass in the 'fail-under' percentage to diff-quality
Expand Down

0 comments on commit 7f23c88

Please sign in to comment.