Python static code analysis
Prospector — My favorite static code analysis tool
Introduction
As a developer we understand the value of testing. Along with various forms of testing static code analysis is a key component that provides us very useful insight into flaws and/or improvements.
There are a number of easy to use tools available for python static code analysis but ‘prospector’ bundles a number of such useful tools and offers a nice useful result that is derived out of popular tools like pylint, pycodestyle and McCabe.
Quick start
If you’re new to prospector and prefer testing on command line then execute the following commands on a python code repository:
cd <python-code-repository>
prospector --strictness medium
Note: Other strictness levels available are low, high and veryhigh
If the tool needs to be run against a specific file then try the following
cd <python-code-repository>
prospector --strictness medium <filename>
Glimpse of results from default setting
Prospector tool maybe customized per project using a yaml file with profile information. They offer options to inherit other profiles and establish strictness and configurations corresponding to required evaluation.
A number of profiles are available at https://github.com/PyCQA/prospector/tree/master/prospector/profiles/profiles.