For the following code
"""Test pylint on undefined variable"""
import random
def main():
"""Use undefined variable"""
if random.randint(0, 10) == 6:
thing = "hi"
print(thing)
if __name__ == '__main__':
main()
PyCharm correctly reports the problem.
pylint
(2.0.0, Python 3.6.6) however does not recognize it:
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
But I would like it to find it, in order to let my CI fail in these cases.
So in fact I have two questions:
- Is there an option for
pylint
to enable so that it can find this kindf of error? - What linting is PyCharm using by default? (I always thought it's
pylint
under the hood.)