Commit dcd24613 authored by Jérome Perrin's avatar Jérome Perrin

pylint: dummy plugin to ignore messages on python2

parent 10988915
......@@ -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
......
"""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))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment