Commit 83538e85 authored by Arnaud Fontaine's avatar Arnaud Fontaine

pylint: Backport 1.5.2 upstream patch to fix super-on-old-class false positives.

Errors were raised in ERP5 with classes inheriting from ExtensionClass.
parent 3c4bbcdf
Pipeline #7277 failed with stage
[buildout]
parts =
pylint
extends =
../patch/buildout.cfg
[pylint]
recipe = zc.recipe.egg:custom
egg = pylint
patches =
${:_profile_base_location_}/pylint-super_on_old_class.patch#cb0c3f8c091bf4980be395c917edc435
patch-options = -p1
patch-binary = ${patch:location}/bin/patch
commit 6cf07b3483ec0d921296aefa8a28a8491f13786e
Author: Claudiu Popa <pcmanticore@gmail.com>
Date: Sun Dec 6 14:54:52 2015 +0200
Don't emit super-on-old-class on classes with unknown bases.
The change also removes the confidence handling for super-on-old-class,
which isn't used enough to merit its existence.
Closes issue #721.
--- a/pylint/checkers/newstyle.py 2019-12-25 13:51:01.611586402 +0900
+++ b/pylint/checkers/newstyle.py 2019-12-25 13:50:31.861542768 +0900
@@ -127,12 +127,9 @@
if isinstance(call, astroid.CallFunc) and \
isinstance(call.func, astroid.Name) and \
call.func.name == 'super':
- confidence = (INFERENCE if has_known_bases(klass)
- else INFERENCE_FAILURE)
- if not klass.newstyle:
+ if not klass.newstyle and has_known_bases(klass):
# super should not be used on an old style class
- self.add_message('super-on-old-class', node=node,
- confidence=confidence)
+ self.add_message('super-on-old-class', node=node)
else:
# super first arg should be the class
if not call.args and sys.version_info[0] == 3:
@@ -146,8 +143,7 @@
continue
if supcls is None:
- self.add_message('missing-super-argument', node=call,
- confidence=confidence)
+ self.add_message('missing-super-argument', node=call)
continue
if klass is not supcls:
@@ -163,8 +159,7 @@
if name is not None:
self.add_message('bad-super-call',
node=call,
- args=(name, ),
- confidence=confidence)
+ args=(name, ))
def register(linter):
......@@ -61,6 +61,7 @@ extends =
../../component/postfix/buildout.cfg
../../component/zbarlight/buildout.cfg
../../component/perl/buildout.cfg
../../component/pylint/buildout.cfg
../../stack/caucase/buildout.cfg
../../software/jupyter/software.cfg
../../software/neoppod/software-common.cfg
......@@ -516,7 +517,7 @@ eggs = ${neoppod:eggs}
decorator
networkx
# Needed for checking ZODB Components source code
pylint
${pylint:egg}
jedi
yapf
typing
......@@ -653,6 +654,8 @@ ocropy = 1.0+SlapOSPatched001
pysvn = 1.7.10+SlapOSPatched002
python-ldap = 2.4.32+SlapOSPatched001
python-magic = 0.4.12+SlapOSPatched001
## https://lab.nexedi.com/nexedi/slapos/merge_requests/648
pylint = 1.4.4
# use newer version than specified in ZTK
PasteDeploy = 1.5.2
......@@ -733,8 +736,6 @@ pycountry = 17.1.8
pycrypto = 2.6.1
pycurl = 7.43.0
pyflakes = 1.5.0
# pylint 1.5.1 breaks testDynamicClassGeneration
pylint = 1.4.4
python-memcached = 1.58
pytracemalloc = 1.2
qrcode = 5.3
......
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