Python: code analysis with pylint

Ckmobile
2 min readNov 30, 2022
Photo by Artturi Jalli on Unsplash

To use the pylint we need to install pylint at terminal.

pip install pylint

Then we can create a file, such as “main.py”.

def add(a,b):
return a+b

print(add(1,3))

Go to the terminal and type “pylint main.py”

************* Module main copy
main copy.py:5:0: C0305: Trailing newlines (trailing-newlines)
main copy.py:1:0: C0114: Missing module docstring (missing-module-docstring)
main copy.py:1:0: C0103: Argument name "a" doesn't conform to snake_case naming style (invalid-name)
main copy.py:1:0: C0103: Argument name "b" doesn't conform to snake_case naming style (invalid-name)
main copy.py:1:0: C0116: Missing function or method docstring (missing-function-docstring)

-------------------------------------
Your code has been rated at -10.00/10

We can see the above

For these two issues, which is about the naming of the argument a and b,

we can change it to num_1 and num_2, which conform to snake case.

--

--