Prospector

Inspects Python source files and provides information about type and location of classes, methods etc

Version

1.1.6.2

Runtime

Python Versions

Supported Languages

Python

Official Documentation

https://github.com/landscapeio/prospector

YAML Configuration

prospector:

  • input:

    Patterns to include in reports.

    Note: The input patterns are not applied when running Prospector since Prospector considers dependency between files and filtering the input files affects how Prospector detects issues. Therefore, the files excluded by the patterns are always processed and you may even see logs related to the excluded files in the job console. However, Inspecode eventually ignores any issues detected on the excluded files when generating job reports.

    If you need to let Prospector ignore particular files, consider specifying -I, --ignore-patterns or -i, --ignore-paths under options: instead.

  • ignore:

    Patterns to exclude from reports.

    Note: Just like input:, the ignore patterns are not applied when running Prospector.

  • auto-fix:

    N/A

  • config-file:

    Alias of --profile option.

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.75 CPU with 2880 MiB RAM.

  • options:

    Below is the list of options that are supported:

    -A, --no-autodetect   Turn off auto-detection of frameworks and libraries
                          used. By default, autodetection will be used. To
                          specify manually, see the --uses option.
    -u USES, --uses USES  A list of one or more libraries or frameworks that the
                          project uses. Possible values are: django, celery,
                          flask. This will be autodetected by default, but if
                          autodetection doesn't work, manually specify them
                          using this flag.
    -B, --no-blending     Turn off blending of messages. Prospector will merge
                          together messages from different tools if they
                          represent the same error. Use this option to see all
                          unmerged messages.
    -D, --doc-warnings    Include warnings about documentation.
    -T, --test-warnings   Also check test modules and packages.
    -8, --no-style-warnings
                          Don't create any warnings about style. This disables
                          the PEP8 tool and similar checks for formatting.
    -m, --member-warnings
                          Attempt to warn when code tries to access an attribute
                          of a class or member of a module which does not exist.
                          This is disabled by default as it tends to be quite
                          inaccurate.
    -F, --full-pep8       Enables every PEP8 warning, so that all PEP8 style
                          violations will be reported.
    --max-line-length MAX_LINE_LENGTH
                          The maximum line length allowed. This will be set by
                          the strictness if no value is explicitly specified
    -M, --messages-only   Only output message information (don't output summary
                          information about the checks)
    --absolute-paths      Whether to output absolute paths when referencing
                          files in messages. By default, paths will be relative
                          to the project path
    -t TOOLS, --tool TOOLS
                          A list of tools to run. This lets you set exactly
                          which tools to run. To add extra tools to the
                          defaults, see --with-tool. Possible values are: dodgy,
                          frosted, mccabe, mypy, pep257, pep8, profile-
                          validator, pyflakes, pylint, pyroma, vulture. By
                          default, the following tools will be run: dodgy,
                          mccabe, pep257, pep8, profile-validator, pyflakes,
                          pylint
    -w WITH_TOOLS, --with-tool WITH_TOOLS
                          A list of tools to run in addition to the default
                          tools. To specify all tools explicitly, use the --tool
                          argument. Possible values are dodgy, frosted, mccabe,
                          mypy, pep257, pep8, profile-validator, pyflakes, pylint,
                          pylint, pyroma, vulture.
    -W WITHOUT_TOOLS, --without-tool WITHOUT_TOOLS
                          A list of tools that should not be run. Useful to turn
                          off only a single tool from the defaults. To specify
                          all tools explicitly, use the --tool argument.
                          Possible values are dodgy, frosted, mccabe, mypy,
                          pep257, pep8, profile-validator, pyflakes, pylint,
                          pyroma, vulture.
    -P PROFILES, --profile PROFILES
                          The list of profiles to load. A profile is a certain
                          'type' of behaviour for prospector, and is represented
                          by a YAML configuration file. Either a full path to
                          the YAML file describing the profile must be provided,
                          or it must be on the profile path (see --profile-path)
    --profile-path PROFILE_PATH
                          Additional paths to search for profile files. By
                          default this is the path that prospector will check,
                          and a directory called ".prospector" in the path that
                          prospector will check.
    -s {veryhigh,high,medium,low,verylow}, --strictness {veryhigh,high,medium,low,verylow}
                          How strict the checker should be. This affects how
                          harshly the checker will enforce coding guidelines.
                          The default value is "medium", possible values are
                          "veryhigh", "high", "medium", "low" and "verylow".
    --show-profile        Include the computed profile in the summary. This will
                          show what prospector has decided the overall profile
                          is once all profiles have been combined and inherited
                          from. This will produce a large output in most cases
                          so is only useful when trying to debug why prospector
                          is not behaving like you expect.
    -E, --no-external-config
                          Determines how prospector should behave when
                          configuration already exists for a tool. By default,
                          prospector will use existing configuration. This flag
                          will cause prospector to ignore existing configuration
                          and use its own settings for every tool. Note that
                          prospector will always use its own config for tools
                          which do not have custom configuration.
    --pylint-config-file PYLINT_CONFIG_FILE
                          The path to a pylintrc file to use to configure
                          pylint. Prospector will find .pylintrc files in the
                          root of the project, but you can use this option to
                          specify manually where it is.
    -I IGNORE_PATTERNS, --ignore-patterns IGNORE_PATTERNS
                          A list of paths to ignore, as a list of regular
                          expressions. Files and folders will be ignored if
                          their full path contains any of these patterns.
    -i IGNORE_PATHS, --ignore-paths IGNORE_PATHS
                          A list of file or directory names to ignore. If the
                          complete name matches any of the items in this list,
                          the file or directory (and all subdirectories) will be
                          ignored.
    
  • thresholds:

    • num-issues:

      No tool specific severity levels are available.

  • experimental:

    • incremental:

      N/A

      Note: The incremental analysis cannot be supported for Prospector. This is because Prospector analyzes source code with dependencies between files and the results on unchanged files can be affected by changed files.

YAML Examples

  • With default options:

    inspecode:
      prospector: default
    
  • With custom machine:

    inspecode:
      prospector:
        machine:
          cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
    
  • With custom options:

    inspecode:
      prospector:
        options:
          --strictness: low
          --without-tool:
            - dodgy
            - pyflakes
            - pylint
    
  • With a configuration file:

    inspecode:
      prospector:
        config-file: ./my-profile.yaml
    

    The above configuration is equivalent to:

    inspecode:
      prospector:
        options:
          --profile: ./my-profile.yaml
    

Configuration File Detection

If no configuration files are specified via config-file or options field, Inspecode walks the file tree in lexical order in your repository to find profiles named one of the followings and runs prospector at each directory where a profile is placed in addition to at the root of your repository:

  • .landscape.yml
  • .landscape.yaml
  • landscape.yml
  • landscape.yaml
  • .prospector.yaml
  • .prospector.yml
  • prospector.yaml
  • prospector.yml
  • prospector/.prospector.yaml
  • prospector/.prospector.yml
  • prospector/prospector.yaml
  • prospector/prospector.yml
  • .prospector/.prospector.yaml
  • .prospector/.prospector.yml
  • .prospector/prospector.yaml
  • .prospector/prospector.yml

Resolving Dependencies

The dependencies are resolved in the same manner as pytest. See the pytest page for the details.

results matching ""

    No results matching ""