nitpick.plugins.toml module
TOML files.
- class nitpick.plugins.toml.TomlPlugin(info: FileInfo, expected_config: JsonDict, autofix=False)[source]
Bases:
NitpickPlugin
Enforce configurations and autofix TOML files.
E.g.: pyproject.toml (PEP 518).
See also the [tool.poetry] section of the pyproject.toml file.
Style example: Python 3.8 version constraint. There are many other examples here.
- enforce_rules() Iterator[Fuss] [source]
Enforce rules for missing key/value pairs in the TOML file.
- expected_config: JsonDict
- file_path: Path
- filename = ''
- identify_tags: ClassVar = {'toml'}
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()
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.
- report(violation: ViolationEnum, document: TOMLDocument | None, change: TomlDoc | None, replacement: TomlDoc | None = None)[source]
Report a violation while optionally modifying the TOML document.
- 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
).
- nitpick.plugins.toml.can_handle(info: FileInfo) type[NitpickPlugin] | None [source]
Handle TOML files.
- nitpick.plugins.toml.plugin_class() type[nitpick.plugins.base.NitpickPlugin] [source]
Handle TOML files.