nitpick.app module

The Nitpick application.

class nitpick.app.NitpickApp[source]

Bases: object

The Nitpick application.

class Flags(value)[source]

Bases: enum.Enum

Flags to be used with flake8 CLI.

OFFLINE = 'Offline mode: no style will be downloaded (no HTTP requests at all)'
add_style_error(file_name: str, message: str, invalid_data: str = None)None[source]

Add a style error to the internal list.

static as_flake8_warning(nitpick_error: nitpick.exceptions.NitpickError) → Tuple[int, int, str, Type][source]

Return a flake8 error as a tuple.

cache_dir: Path = None
clear_cache_dir()pathlib.Path[source]

Clear the cache directory (on the project root or on the current directory).

config: Config = None
classmethod create_app(offline=False)nitpick.app.NitpickApp[source]

Create a single application.

classmethod current()[source]

Get the current app from the stack.

find_main_python_file()pathlib.Path[source]

Find the main Python file in the root dir, the one that will be used to report Flake8 warnings.

The search order is: 1. Python files that belong to the root dir of the project (e.g.: setup.py, autoapp.py). 2. manage.py: they can be on the root or on a subdir (Django projects). 3. Any other *.py Python file on the root dir and subdir. This avoid long recursions when there is a node_modules subdir for instance.

static find_root_dir()pathlib.Path[source]

Find the root dir of the Python project (the one that has one of the ROOT_FILES).

Start from the current working dir.

classmethod format_env(flag: enum.Enum)str[source]

Format the name of an environment variable.

classmethod format_flag(flag: enum.Enum)str[source]

Format the name of a flag to be used on the CLI.

classmethod get_env(flag: enum.Enum)str[source]

Get the value of an environment variable.

static load_plugins() → pluggy.manager.PluginManager[source]

Load all defined plugins.

main_python_file: Path = None
plugin_manager: PluginManager = None
root_dir: Path = None