Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
138
Merge Requests
138
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
dcd24613
Commit
dcd24613
authored
Apr 21, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pylint: dummy plugin to ignore messages on python2
parent
10988915
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
5 deletions
+32
-5
product/ERP5Type/Utils.py
product/ERP5Type/Utils.py
+7
-5
product/ERP5Type/patches/pylint_compatibility_disable.py
product/ERP5Type/patches/pylint_compatibility_disable.py
+25
-0
No files found.
product/ERP5Type/Utils.py
View file @
dcd24613
...
...
@@ -554,6 +554,7 @@ def checkPythonSourceCode(source_code_str, portal_type=None):
args
.
extend
(
(
"--msg-template='{C}: {line},{column}: {msg} ({symbol})'"
,
'--load-plugins=pylint.extensions.bad_builtin'
,
# BBB until we drop compatibility with PY2
'--disable=redundant-u-string-prefix,raise-missing-from,keyword-arg-before-vararg'
,
# XXX acceptable to ignore in the context of ERP5
...
...
@@ -563,6 +564,12 @@ def checkPythonSourceCode(source_code_str, portal_type=None):
'--disable=duplicate-bases,inconsistent-mro'
,
)
)
else
:
args
.
extend
(
(
'--load-plugins=Products.ERP5Type.patches.pylint_compatibility_disable'
,
)
)
if
portal_type
==
'Interface Component'
:
# __init__ method from base class %r is not called
args
.
append
(
'--disable=W0231'
)
...
...
@@ -575,11 +582,6 @@ def checkPythonSourceCode(source_code_str, portal_type=None):
# Method should have "self" as first argument (no-self-argument)
args
.
append
(
'--disable=E0213'
)
try
:
from
pylint.extensions.bad_builtin
import
__name__
as
ext
args
.
append
(
'--load-plugins='
+
ext
)
except
ImportError
:
pass
try
:
# Note that we don't run pylint as a subprocess, but directly from
# ERP5 process, so that pylint can access the code from ERP5Type
...
...
product/ERP5Type/patches/pylint_compatibility_disable.py
0 → 100644
View file @
dcd24613
"""A dummy checker to register messages from pylint3, to be able to
disable the messages on python2 without causing bad-option-value
"""
from
__future__
import
absolute_import
from
pylint
import
checkers
,
interfaces
class
CompatibilityDisableChecker
(
checkers
.
BaseChecker
):
name
=
"compatibility-disable"
msgs
=
{
"E9991"
:
(
"The raise statement is not inside an except clause"
,
"misplaced-bare-raise"
,
""
,
),
"W9992"
:
(
"Unused private member"
,
"unused-private-member"
,
""
,
),
}
def
register
(
linter
):
linter
.
register_checker
(
CompatibilityDisableChecker
(
linter
))
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