When a class contains usage of an undefined function, pylint 0.19.0 will
stop running and not report any errors on the file. This works in pylint
0.18.1.
This is a critical error as a typo in a function name will cause the
entire checking process to fail.
Testcase is below:
# Comment out this class to get pylint warnings on class 2
# Uncomment this class to have pylint not generate any warnings
class class1(object):
def determineAccess(self, userName,
resources=None):
if not resources:
# This function is undefined, causes pylint to not warn on
anything in this file
userObj = self.thisFunctionDoesNotExist()
# Resource is undefined in the following line:
for resourceName in resource:
print str(resource)
# No errors on the following line
this = is_ - obviously + wrong
class class2(object):
def determineAccess(self, userName,
resources=None):
if not resources:
# This function is undefined, causes pylint to fail to warn
anything on this function
userObj = self.thisFunctionDoesExist()
# Resource is undefined in the following line:
for resourceName in resource:
print str(resource)
def thisFunctionDoesExist(self):
return "a"
________________
pylint 0.19.0 output:
[tsava...@tsavanna64 ResourceFilter]$ pylint test.py
************* Module test
C0103: 4:class1: Invalid name "class1" (should match [A-Z_]+[a-zA-Z0-9]+$)
pylint 0.19.0 output with "class1" and the 'this = is_ - obviously +
wrong' line commented:
[tsava...@tsavanna64 ResourceFilter]$ pylint test.py
************* Module test
C0103: 12:class2: Invalid name "class2" (should match [A-Z_]+[a-zA-Z0-9]+$)
E0602: 19:class2.determineAccess: Undefined variable 'resource'
E0602: 20:class2.determineAccess: Undefined variable 'resource'
W0613: 13:class2.determineAccess: Unused argument 'userName'
W0612: 19:class2.determineAccess: Unused variable 'resourceName'
W0612: 17:class2.determineAccess: Unused variable 'userObj'
R0201: 22:class2.thisFunctionDoesExist: Method could be a function
pylint 0.18.1 output with full file:
[tsava...@tsavanna64 ResourceFilter]$ pylint test.py
************* Module test
C0103: 4:class1: Invalid name "class1" (should match [A-Z_]+[a-zA-Z0-9]+$)
E1101: 9:class1.determineAccess: Instance of 'class1' has no
'thisFunctionDoesNotExist' member
E0602: 11:class1.determineAccess: Undefined variable 'resource'
E0602: 12:class1.determineAccess: Undefined variable 'resource'
W0613: 5:class1.determineAccess: Unused argument 'userName'
W0612: 11:class1.determineAccess: Unused variable 'resourceName'
W0612: 9:class1.determineAccess: Unused variable 'userObj'
R0903: 4:class1: Too few public methods (1/2)
E0602: 15: Undefined variable 'is_'
E0602: 15: Undefined variable 'obviously'
E0602: 15: Undefined variable 'wrong'
C0103: 17:class2: Invalid name "class2" (should match [A-Z_]+[a-zA-Z0-9]+$)
E0602: 24:class2.determineAccess: Undefined variable 'resource'
E0602: 25:class2.determineAccess: Undefined variable 'resource'
W0613: 18:class2.determineAccess: Unused argument 'userName'
W0612: 24:class2.determineAccess: Unused variable 'resourceName'
W0612: 22:class2.determineAccess: Unused variable 'userObj'
R0201: 27:class2.thisFunctionDoesExist: Method could be a function
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects