Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
6d8ce9bc
Commit
6d8ce9bc
authored
7 years ago
by
Calen Pennington
Browse files
Options
Downloads
Patches
Plain Diff
Move pylint sys.path hackery into pylintrc so that any use of pylint gets it
parent
840eb0be
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pavelib/quality.py
+9
-28
9 additions, 28 deletions
pavelib/quality.py
pylintrc
+2
-1
2 additions, 1 deletion
pylintrc
pylintrc_tweaks
+1
-0
1 addition, 0 deletions
pylintrc_tweaks
with
12 additions
and
29 deletions
pavelib/quality.py
+
9
−
28
View file @
6d8ce9bc
...
...
@@ -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
,
...
...
This diff is collapsed.
Click to expand it.
pylintrc
+
2
−
1
View file @
6d8ce9bc
...
...
@@ -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
This diff is collapsed.
Click to expand it.
pylintrc_tweaks
+
1
−
0
View file @
6d8ce9bc
# 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}$
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment