Friday 6 March 2020

Pylint in python/ Pylint score testing/ pylint package / Pylint Tutorial

pylint:
Pylint isn't smarter than you are: it may warn you about things that you have dedicated done.
Pylint tries hard to report as few false positives.

How to install pylint
==> Windows / OS X (MAC)     pip install pylint 
==> Ubuntu / Debian OS            sudo apt-get install pylint

from command prompt:
=================
python.exe -m pip install --upgrade pip
python -m pip install pylint

Utilization of pylint:
------------------------
==>  In terminal / command prompt go to the python file path.
==>  python -m pylint operators.py
==>  pylint  file_name.py  # this command will display  how much score your code rated.
                       or
        pylint directory/mymodule.py

Parallel pylint score validation : 
======================
It is possible to speed up the execution of Pylint.
If the running computer has more CPUs than one, then the work for checking all files could be spread across all cores via Pylints's sub-processes.
This functionality is exposed via the -j command-line parameter.
If the provided number is 0, then the total number of CPUs will be autodetected and used.

pylint -j 4 File_name1.py File_name2.py File_name3.py File_name4.py


This will spawn 4 parallel Pylint sub-process, where each provided module will be checked in parallel. Discovered problems by checkers are not displayed immediately. They are shown just after checking a module is complete.
There are some limitations in running checks in parallel in the current implementation. It is not possible to use custom plugins (i.e. --load-plugins option), nor it is not possible to use initialization hooks (i.e. the --init-hook option).

Exit codes

Pylint returns bit-encoded exit codes. If applicable, the table below lists the related stderr stream message output.
exit codemeaningstderr stream message
0no error
1fatal message issued
2error message issued
4warning message issued
8refactor message issued
16convention message issued
32usage error
  • "internal error while receiving resultsfrom child linter" "Error occurred, stopping the linter."
  • "<return of linter.help()>"
  • "Jobs number <#> should be greater than 0"

No comments:

Post a Comment