Git Product home page Git Product logo

prospector2's Introduction

prospector

Latest Version of Prospector Build Status Code Health Test Coverage Documentation

Read This First!

** THIS REPOSITORY IS DEAD **

Python2 end of life was on January 1st 2020, and had been deprecated for much longer. This repository is not maintained.

~~~

Prospector was originally written as part of https://landscape.io and 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 at https://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.

About

Prospector 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 as Pylint, pep8, and McCabe complexity. See the Supported Tools documentation 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.

Installation

Prospector can be installed using pip by running the following command:

pip install prospector

Optional dependencies for Prospector, such as pyroma can 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 on Supported Tools Extras.

For more detailed information on installing the tool, see the installation section of the tool's main page on ReadTheDocs.

Documentation

Full documentation is available at ReadTheDocs.

Usage

Simply run prospector from the root of your project:

prospector

This 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 times

Options

Run prospector --help for a full list of options and their effects.

Output Format

The default output format of prospector is designed to be human readable. For parsing (for example, for reporting), you can use the --output-format json flag to get JSON-formatted output.

Profiles

Prospector is configurable using "profiles". These are composable YAML files with directives to disable or enable tools or messages. For more information, read the documentation about profiles.

If your code uses frameworks and libraries

Often 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 accessing objects, as the objects attribute is not part of the Model class 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 by detecting dependencies and 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 celery

Additionally, if Prospector is automatically detecting a library that you do not in fact use, you can turn off autodetection completely:

prospector --no-autodetect

Note 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.

Strictness

Prospector has a configurable 'strictness' level which will determine how harshly it searches for errors:

prospector --strictness high

Possible values are verylow, low, medium, high, veryhigh.

Prospector does not include documentation warnings by default, but you can turn this on using the --doc-warnings flag.

License

Prospector is available under the GPLv2 License.

prospector2's People

Contributors

carlio avatar chocoelho avatar jayclassless avatar jquast avatar smspillaz avatar prophile avatar guykisel avatar jakirkham avatar nnonexistent avatar rylans avatar sijis avatar kirang89 avatar merwok avatar tnir avatar lfrodrigues avatar arthepsy avatar trbs avatar stdweird avatar kaidokert avatar bsherrill480 avatar ustun avatar alefteris avatar szabolcsdombi avatar twidi avatar philroberts avatar prikhi avatar pahaz avatar perdy avatar gregorypease280 avatar donjayamanne avatar

Stargazers

CoCaptainHenri avatar oiwn avatar Bumsoo Kim avatar Alexander Hultnér avatar Bhave sh avatar Goodwin Lawlor avatar Michael Ludwig avatar Bloo Alien avatar Dimitris Rudas avatar Alexander Koshelev avatar Michael Russo avatar Raja Shekar avatar Timothy Spann avatar  avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

prospector2's Issues

[BUG] prospector2 won't install on Windows apparently since using forward slash instead of os.path.join

The prospector2 package doesn't install on Windows (Python 2.7).

  • Additionally, where is prospector2? The pypi page links to here. I can't tell if this is a fork of anything because it doesn't say so in the GitHub interface, but the pypi page says prospector2 is a Python 2 fork of prospector.

To Reproduce Steps to reproduce the behavior:

  1. Open a Windows Command Prompt
  2. py -2 -m pip install prospector2
  3. See error

Expected behavior

  • Should install prospector2
  • Should use os.path.join

Screenshots

>py -2 -m pip install prospector2
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting prospector2
  Downloading prospector2-0.1.tar.gz (50 kB)
     |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 50 kB 1.1 MB/s
    ERROR: Command errored out with exit status 1:
     command: 'C:\Python27\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\owner\\appdata\\local\\temp\\pip-install-ffhpl_\\prospector2\\setup.py'"'"'; __file__='"'"'c:\\users\\owner\\appdata\\local\\temp\\pip-install-ffhpl_\\prospector2\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'c:\users\owner\appdata\local\temp\pip-pip-egg-info-w5z0au'
         cwd: c:\users\owner\appdata\local\temp\pip-install-ffhpl_\prospector2\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\owner\appdata\local\temp\pip-install-ffhpl_\prospector2\setup.py", line 37, in <module>
        _PACKAGE_DATA['prospector2'] += [profile for profile in os.listdir(profiledir)]
    WindowsError: [Error 3] The system cannot find the path specified: 'c:\\users\\owner\\appdata\\local\\temp\\pip-install-ffhpl_\\prospector2\\prospector2/profiles/profiles\\*.*'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Environment (please complete the following information):

  • OS: Windows 10
  • Tool: pip
  • Prospector version prospector2-0.1
  • Python version 2.7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.