nitpick.plugins.base module

Base class for file checkers.

class nitpick.plugins.base.NitpickPlugin(config: Dict[str, Any], file_name: str = None)[source]

Bases: nitpick.mixin.NitpickMixin

Base class for file checkers.

check_exists() → Iterator[Tuple[int, int, str, Type]][source]

Check if the file should exist.

abstract check_rules() → Iterator[Tuple[int, int, str, Type]][source]

Check rules for this file. It should be overridden by inherited classes if needed.

dynamic_name_classes: Set[Type[NitpickPlugin]] = {}
error_base_number = 300
error_prefix = ''
file_name = ''
fixed_name_classes: Set[Type[NitpickPlugin]] = {}
flake8_error(number: int, message: str, suggestion: str = None, add_to_base_number=True) → Tuple[int, int, str, Type]

Return a flake8 error as a tuple.

classmethod get_compiled_jmespath_file_names()[source]

Return a compiled JMESPath expression for file names, using the class name as part of the key.

identify_tags: Set[str] = {}

Which identify tags this nitpick.plugins.base.NitpickPlugin child recognises.

classmethod load_fixed_dynamic_classes()None[source]

Separate classes with fixed file names from classes with dynamic files names.

abstract suggest_initial_contents()str[source]

Suggest the initial content for this missing file.

validation_schema: Optional[Schema] = None

Nested validation field for this file, to be applied in runtime when the validation schema is rebuilt. Useful when you have a strict configuration for a file type (e.g. nitpick.plugins.json.JSONPlugin).

warn_missing_different(comparison: nitpick.formats.Comparison, prefix_message: str = '')

Warn about missing and different keys.