Reputation: 11
if goal:
checkA = checkAfunc(user, goal)
if not checkA:
if goal:
xyz, _ = checkB(user, goal)
else
xyz, _ = checkB(user, goal)
checkA = xyz or checkA
While refactoring the above code, it got committed without throwing any exception. pylint check is also not emitting any error While pycharm also uses pylint , it shows - Local variable 'xyz' might be referenced before assignment. What rule shall be further added in pylint config for emitting this exception before committing the code itself?
Upvotes: 1
Views: 300
Reputation: 111
pylint reports for un-initialized/un-defined variable , if only it can be statically so determined . for eg ,pylint will not warn for x being un-defined in the following piece of code (as it is pure static analysis tool)
y=10
if y==4:
x=5
print(x)
pycharm does not use pylint by default. You will have to specifically configure pylint to be used. pycharm has its own inbuilt checker, which seems to check for conditional paths too. pycharm will warn you
Upvotes: 1