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
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
f521dd20
Commit
f521dd20
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
417d5c83
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
5 deletions
+72
-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
+65
-0
No files found.
product/ERP5Type/Utils.py
View file @
f521dd20
...
...
@@ -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 @
f521dd20
"""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
=
{
"E9990"
:
(
"not-an-iterable"
,
"not-an-iterable"
,
""
,
),
"E9991"
:
(
"misplaced-bare-raise"
,
"misplaced-bare-raise"
,
""
,
),
"W9992"
:
(
"unused-private-member"
,
"unused-private-member"
,
""
,
),
"E9993"
:
(
"using-constant-test"
,
"using-constant-test"
,
""
),
"E9994"
:
(
"modified-iterating-list"
,
"modified-iterating-list"
,
""
,
),
"E9995"
:
(
"unsubscriptable-object"
,
"unsubscriptable-object"
,
""
,
),
"E9996"
:
(
"invalid-unary-operand-type"
,
"invalid-unary-operand-type"
,
""
,
),
"E9997"
:
(
"unbalanced-dict-unpacking"
,
"unbalanced-dict-unpacking"
,
""
,
),
"E9998"
:
(
"self-cls-assignment"
,
"self-cls-assignment"
,
""
,
),
"E9999"
:
(
"deprecated-class"
,
"deprecated-class"
,
""
,
),
}
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