Move pylint sys.path hackery into pylintrc so that any use of pylint gets it
This commit is contained in:
@@ -57,22 +57,17 @@ def find_fixme(options):
|
||||
|
||||
apps_list = ' '.join(top_python_dirs(system))
|
||||
|
||||
pythonpath_prefix = (
|
||||
"PYTHONPATH={system}/djangoapps:common/djangoapps:common/lib".format(
|
||||
system=system
|
||||
)
|
||||
)
|
||||
|
||||
sh(
|
||||
"{pythonpath_prefix} pylint --disable all --enable=fixme "
|
||||
cmd = (
|
||||
"pylint --disable all --enable=fixme "
|
||||
"--output-format=parseable {apps} "
|
||||
"> {report_dir}/pylint_fixme.report".format(
|
||||
pythonpath_prefix=pythonpath_prefix,
|
||||
apps=apps_list,
|
||||
report_dir=report_dir
|
||||
)
|
||||
)
|
||||
|
||||
sh(cmd, ignore_error=True)
|
||||
|
||||
num_fixme += _count_pylint_violations(
|
||||
"{report_dir}/pylint_fixme.report".format(report_dir=report_dir))
|
||||
|
||||
@@ -109,20 +104,14 @@ def run_pylint(options):
|
||||
|
||||
apps_list = ' '.join(top_python_dirs(system))
|
||||
|
||||
pythonpath_prefix = (
|
||||
"PYTHONPATH={system}/djangoapps:common/djangoapps:common/lib".format(
|
||||
system=system
|
||||
)
|
||||
)
|
||||
|
||||
sh(
|
||||
"{pythonpath_prefix} pylint {flags} --output-format=parseable {apps} "
|
||||
"pylint {flags} --output-format=parseable {apps} "
|
||||
"> {report_dir}/pylint.report".format(
|
||||
pythonpath_prefix=pythonpath_prefix,
|
||||
flags=" ".join(flags),
|
||||
apps=apps_list,
|
||||
report_dir=report_dir
|
||||
)
|
||||
),
|
||||
ignore_error=True,
|
||||
)
|
||||
|
||||
num_violations += _count_pylint_violations(
|
||||
@@ -768,15 +757,9 @@ def run_quality(options):
|
||||
eslint_files = get_violations_reports("eslint")
|
||||
eslint_reports = u' '.join(eslint_files)
|
||||
|
||||
pythonpath_prefix = (
|
||||
"PYTHONPATH=$PYTHONPATH:lms:lms/djangoapps:cms:cms/djangoapps:"
|
||||
"common:common/djangoapps:common/lib"
|
||||
)
|
||||
|
||||
# run diff-quality for pylint.
|
||||
if not run_diff_quality(
|
||||
violations_type="pylint",
|
||||
prefix=pythonpath_prefix,
|
||||
reports=pylint_reports,
|
||||
percentage_string=percentage_string,
|
||||
branch_string=compare_branch_string,
|
||||
@@ -787,7 +770,6 @@ def run_quality(options):
|
||||
# run diff-quality for eslint.
|
||||
if not run_diff_quality(
|
||||
violations_type="eslint",
|
||||
prefix=pythonpath_prefix,
|
||||
reports=eslint_reports,
|
||||
percentage_string=percentage_string,
|
||||
branch_string=compare_branch_string,
|
||||
@@ -801,7 +783,7 @@ def run_quality(options):
|
||||
|
||||
|
||||
def run_diff_quality(
|
||||
violations_type=None, prefix=None, reports=None, percentage_string=None, branch_string=None, dquality_dir=None
|
||||
violations_type=None, reports=None, percentage_string=None, branch_string=None, dquality_dir=None
|
||||
):
|
||||
"""
|
||||
This executes the diff-quality commandline tool for the given violation type (e.g., pylint, eslint).
|
||||
@@ -810,11 +792,10 @@ def run_diff_quality(
|
||||
"""
|
||||
try:
|
||||
sh(
|
||||
"{pythonpath_prefix} diff-quality --violations={type} "
|
||||
"diff-quality --violations={type} "
|
||||
"{reports} {percentage_string} {compare_branch_string} "
|
||||
"--html-report {dquality_dir}/diff_quality_{type}.html ".format(
|
||||
type=violations_type,
|
||||
pythonpath_prefix=prefix,
|
||||
reports=reports,
|
||||
percentage_string=percentage_string,
|
||||
compare_branch_string=branch_string,
|
||||
|
||||
3
pylintrc
3
pylintrc
@@ -56,6 +56,7 @@
|
||||
ignore = ,.git,.tox,migrations,node_modules,.pycharm_helpers
|
||||
persistent = yes
|
||||
load-plugins = edx_lint.pylint,pylint_django,pylint_celery
|
||||
init-hook = "import sys; sys.path.extend(['lms/djangoapps', 'cms/djangoapps', 'common/djangoapps'])"
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
enable =
|
||||
@@ -444,4 +445,4 @@ int-import-graph =
|
||||
[EXCEPTIONS]
|
||||
overgeneral-exceptions = Exception
|
||||
|
||||
# ebf3c66ab89931381f66d2fbf20aa581696156c2
|
||||
# cb770bb6272f6fe1edfd74aa1fb912be5541481c
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# pylintrc tweaks for use with edx_lint.
|
||||
[MASTER]
|
||||
ignore+ = ,.git,.tox,migrations,node_modules,.pycharm_helpers
|
||||
init-hook="import sys; sys.path.extend(['lms/djangoapps', 'cms/djangoapps', 'common/djangoapps'])"
|
||||
|
||||
[BASIC]
|
||||
attr-rgx = [a-z_][a-z0-9_]{2,40}$
|
||||
|
||||
Reference in New Issue
Block a user