Pylint

Pylint is a library which examines your code and reports back possible issues, it is a static code analyser. In the terminal window I type

pip install pylint

I create the following with Notepad++ and saved in Exercises_09 as pylint1.py

a = 1
b = 2
c = "JOR"

print(a+b)
print(a+B)
print(a+c)

Wow, it gave me 0/10 marks!

  • The C prefixes are style issues flagged by pylint.

  • The E prefix is an actual error, I have mistakenly used capital B in my code.

Review Pylint here.

Exercise

Rewrite my simple code and get as close as you can to 10/10. Make any assumptions you need. I wrote and saved as pylint2.py

It took me a few goes looking at the test before I got full marks.

A static code check can be good for quality assurance in teams.