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
6d8ce9bc
Commit
6d8ce9bc
authored
Apr 20, 2017
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move pylint sys.path hackery into pylintrc so that any use of pylint gets it
parent
840eb0be
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
29 deletions
+12
-29
pavelib/quality.py
+9
-28
pylintrc
+2
-1
pylintrc_tweaks
+1
-0
No files found.
pavelib/quality.py
View file @
6d8ce9bc
...
@@ -57,22 +57,17 @@ def find_fixme(options):
...
@@ -57,22 +57,17 @@ def find_fixme(options):
apps_list
=
' '
.
join
(
top_python_dirs
(
system
))
apps_list
=
' '
.
join
(
top_python_dirs
(
system
))
pythonpath_prefix
=
(
cmd
=
(
"PYTHONPATH={system}/djangoapps:common/djangoapps:common/lib"
.
format
(
"pylint --disable all --enable=fixme "
system
=
system
)
)
sh
(
"{pythonpath_prefix} pylint --disable all --enable=fixme "
"--output-format=parseable {apps} "
"--output-format=parseable {apps} "
"> {report_dir}/pylint_fixme.report"
.
format
(
"> {report_dir}/pylint_fixme.report"
.
format
(
pythonpath_prefix
=
pythonpath_prefix
,
apps
=
apps_list
,
apps
=
apps_list
,
report_dir
=
report_dir
report_dir
=
report_dir
)
)
)
)
sh
(
cmd
,
ignore_error
=
True
)
num_fixme
+=
_count_pylint_violations
(
num_fixme
+=
_count_pylint_violations
(
"{report_dir}/pylint_fixme.report"
.
format
(
report_dir
=
report_dir
))
"{report_dir}/pylint_fixme.report"
.
format
(
report_dir
=
report_dir
))
...
@@ -109,20 +104,14 @@ def run_pylint(options):
...
@@ -109,20 +104,14 @@ def run_pylint(options):
apps_list
=
' '
.
join
(
top_python_dirs
(
system
))
apps_list
=
' '
.
join
(
top_python_dirs
(
system
))
pythonpath_prefix
=
(
"PYTHONPATH={system}/djangoapps:common/djangoapps:common/lib"
.
format
(
system
=
system
)
)
sh
(
sh
(
"
{pythonpath_prefix}
pylint {flags} --output-format=parseable {apps} "
"pylint {flags} --output-format=parseable {apps} "
"> {report_dir}/pylint.report"
.
format
(
"> {report_dir}/pylint.report"
.
format
(
pythonpath_prefix
=
pythonpath_prefix
,
flags
=
" "
.
join
(
flags
),
flags
=
" "
.
join
(
flags
),
apps
=
apps_list
,
apps
=
apps_list
,
report_dir
=
report_dir
report_dir
=
report_dir
)
),
ignore_error
=
True
,
)
)
num_violations
+=
_count_pylint_violations
(
num_violations
+=
_count_pylint_violations
(
...
@@ -768,15 +757,9 @@ def run_quality(options):
...
@@ -768,15 +757,9 @@ def run_quality(options):
eslint_files
=
get_violations_reports
(
"eslint"
)
eslint_files
=
get_violations_reports
(
"eslint"
)
eslint_reports
=
u' '
.
join
(
eslint_files
)
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.
# run diff-quality for pylint.
if
not
run_diff_quality
(
if
not
run_diff_quality
(
violations_type
=
"pylint"
,
violations_type
=
"pylint"
,
prefix
=
pythonpath_prefix
,
reports
=
pylint_reports
,
reports
=
pylint_reports
,
percentage_string
=
percentage_string
,
percentage_string
=
percentage_string
,
branch_string
=
compare_branch_string
,
branch_string
=
compare_branch_string
,
...
@@ -787,7 +770,6 @@ def run_quality(options):
...
@@ -787,7 +770,6 @@ def run_quality(options):
# run diff-quality for eslint.
# run diff-quality for eslint.
if
not
run_diff_quality
(
if
not
run_diff_quality
(
violations_type
=
"eslint"
,
violations_type
=
"eslint"
,
prefix
=
pythonpath_prefix
,
reports
=
eslint_reports
,
reports
=
eslint_reports
,
percentage_string
=
percentage_string
,
percentage_string
=
percentage_string
,
branch_string
=
compare_branch_string
,
branch_string
=
compare_branch_string
,
...
@@ -801,7 +783,7 @@ def run_quality(options):
...
@@ -801,7 +783,7 @@ def run_quality(options):
def
run_diff_quality
(
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).
This executes the diff-quality commandline tool for the given violation type (e.g., pylint, eslint).
...
@@ -810,11 +792,10 @@ def run_diff_quality(
...
@@ -810,11 +792,10 @@ def run_diff_quality(
"""
"""
try
:
try
:
sh
(
sh
(
"
{pythonpath_prefix}
diff-quality --violations={type} "
"diff-quality --violations={type} "
"{reports} {percentage_string} {compare_branch_string} "
"{reports} {percentage_string} {compare_branch_string} "
"--html-report {dquality_dir}/diff_quality_{type}.html "
.
format
(
"--html-report {dquality_dir}/diff_quality_{type}.html "
.
format
(
type
=
violations_type
,
type
=
violations_type
,
pythonpath_prefix
=
prefix
,
reports
=
reports
,
reports
=
reports
,
percentage_string
=
percentage_string
,
percentage_string
=
percentage_string
,
compare_branch_string
=
branch_string
,
compare_branch_string
=
branch_string
,
...
...
pylintrc
View file @
6d8ce9bc
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
ignore = ,.git,.tox,migrations,node_modules,.pycharm_helpers
ignore = ,.git,.tox,migrations,node_modules,.pycharm_helpers
persistent = yes
persistent = yes
load-plugins = edx_lint.pylint,pylint_django,pylint_celery
load-plugins = edx_lint.pylint,pylint_django,pylint_celery
init-hook = "import sys; sys.path.extend(['lms/djangoapps', 'cms/djangoapps', 'common/djangoapps'])"
[MESSAGES CONTROL]
[MESSAGES CONTROL]
enable =
enable =
...
@@ -444,4 +445,4 @@ int-import-graph =
...
@@ -444,4 +445,4 @@ int-import-graph =
[EXCEPTIONS]
[EXCEPTIONS]
overgeneral-exceptions = Exception
overgeneral-exceptions = Exception
#
ebf3c66ab89931381f66d2fbf20aa581696156c2
#
cb770bb6272f6fe1edfd74aa1fb912be5541481c
pylintrc_tweaks
View file @
6d8ce9bc
# pylintrc tweaks for use with edx_lint.
# pylintrc tweaks for use with edx_lint.
[MASTER]
[MASTER]
ignore+ = ,.git,.tox,migrations,node_modules,.pycharm_helpers
ignore+ = ,.git,.tox,migrations,node_modules,.pycharm_helpers
init-hook="import sys; sys.path.extend(['lms/djangoapps', 'cms/djangoapps', 'common/djangoapps'])"
[BASIC]
[BASIC]
attr-rgx = [a-z_][a-z0-9_]{2,40}$
attr-rgx = [a-z_][a-z0-9_]{2,40}$
...
...
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