Base class for file checkers.
- class nitpick.plugins.base.NitpickPlugin(info: FileInfo, expected_config: Dict[str, Any], autofix=False)
Base class for Nitpick plugins.
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]
Enforce rules for this file. It must be overridden by inherited classes if needed.
- filename = ''
- property nitpick_file_dict: Dict[str, Any]
Nitpick configuration for this file as a TOML dict, taken from the style file.
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
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.
- write_file(file_exists: bool) Fuss | None
Hook to write the new file when autofix mode is on. Should be used by inherited classes.