Package: prospector2
Read This First!Prospector was originally written as part ofhttps://landscape.ioand has been moved across
to the PyCQA group of python code analysis tools to enable it to have more maintainers and
more frequent bug fixes and updates.The official version (which is still supported by myself, @carlio) is athttps://github.com/PyCQA/prospector.This fork is to keep a version which will continue to run under Python2, as various dependencies and libraries
that prospector uses or tests - such as pylint, astroid, and Django - have stopped supporting python2.This version of prospector will use older versions of those libraries in order to keep Python2 compatability,
however, the main reason for this is to allow Landscape.io to continue checking python-2-based codebases. You
are welcome to use this in your own projects and I will do my best to keep it working however the recommended
use case in personal projects or your own CI setup is to migrate to using Python3 and the PyCQA version of prospector.Additionally this fork will not support Python3 but instead be only supporting Python2.AboutProspector is a tool to analyse Python code and output information about
errors, potential problems, convention violations and complexity.It brings together the functionality of other Python analysis tools such asPylint,pep8,
andMcCabe complexity.
See theSupported Toolsdocumentation section for a complete list.The primary aim of Prospector is to be useful ‘out of the box’. A common complaint of other
Python analysis tools is that it takes a long time to filter through which errors are relevant
or interesting to your own coding style. Prospector provides some default profiles, which
hopefully will provide a good starting point and will be useful straight away, and adapts
the output depending on the libraries your project uses.InstallationProspector can be installed usingpipby running the following command:pip install prospectorOptional dependencies for Prospector, such aspyromacan also be installed by running:pip install prospector[with_pyroma]For a list of all of the optional dependencies, see the optional extras section on the ReadTheDocs
page onSupported Tools Extras.For more detailed information on installing the tool, see theinstallation sectionof the tool’s main page
on ReadTheDocs.DocumentationFulldocumentation is available at ReadTheDocs.UsageSimply run prospector from the root of your project:prospectorThis will output a list of messages pointing out potential problems or errors, for example:prospector.tools.base (prospector/tools/base.py):
    L5:0 ToolBase: pylint - R0922
    Abstract class is only referenced 1 timesOptionsRunprospector--helpfor a full list of options and their effects.Output FormatThe default output format ofprospectoris designed to be human readable. For parsing
(for example, for reporting), you can use the--output-formatjsonflag to get JSON-formatted
output.ProfilesProspector is configurable using “profiles”. These are composable YAML files with directives to
disable or enable tools or messages. For more information, readthe documentation about profiles.If your code uses frameworks and librariesOften tools such as pylint find errors in code which is not an error, for example due to attributes of classes being
created at run time by a library or framework used by your project.
For example, by default, pylint will generate an error for Django models when accessingobjects, as theobjectsattribute is not part of theModelclass definition.Prospector mitigates this by providing an understanding of these frameworks to the underlying tools.Prospector will try to intuit which libraries your project uses bydetecting dependenciesand automatically turning on
support for the requisite libraries. You can see which adaptors were run in the metadata section of the report.If Prospector does not correctly detect your project’s dependencies, you can specify them manually from the commandline:prospector --uses django celeryAdditionally, if Prospector is automatically detecting a library that you do not in fact use, you can turn
off autodetection completely:prospector --no-autodetectNote that as far as possible, these adaptors have been written as plugins or augmentations for the underlying
tools so that they can be used without requiring Prospector. For example, the Django support is available as a pylint plugin.StrictnessProspector has a configurable ‘strictness’ level which will determine how harshly it searches for errors:prospector --strictness highPossible values areverylow,low,medium,high,veryhigh.Prospector does not include documentation warnings by default, but you can turn
this on using the--doc-warningsflag.LicenseProspector is available under the GPLv2 License.