nitpick.plugins.base module
Base class for file checkers.
- class nitpick.plugins.base.NitpickPlugin(info: FileInfo, expected_config: JsonDict, autofix=False)[source]
Bases:
object
Base class for Nitpick plugins.
- Parameters:
data – File information (project, path, tags).
expected_config – Expected configuration for the file
autofix – Flag to modify files, if the plugin supports it (default: True).
- abstract enforce_rules() Iterator[Fuss] [source]
Enforce rules for this file. It must be overridden by inherited classes if needed.
- filename = ''
- identify_tags: set[str] = {}
Which
identify
tags thisnitpick.plugins.base.NitpickPlugin
child recognises.
- property nitpick_file_dict: Dict[str, Any]
Nitpick configuration for this file as a TOML dict, taken from the style file.
- post_init()[source]
Hook for plugin initialization after the instance was created.
The name mimics
__post_init__()
on dataclasses, without the magic double underscores: Post-init processing
- predefined_special_config() SpecialConfig [source]
Create a predefined special configuration for this plugin. Each plugin can override this method.
- skip_empty_suggestion = False
- validation_schema: Schema | None = 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
).