nitpick.plugins.setup_cfg module

Checker for the setup.cfg <https://docs.python.org/3/distutils/configfile.html> config file.

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

Bases: nitpick.plugins.base.NitpickPlugin

Checker for the setup.cfg config file.

Example: flake8 configuration.

COMMA_SEPARATED_VALUES = 'comma_separated_values'
check_exists() → Iterator[Tuple[int, int, str, Type]]

Check if the file should exist.

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

Check missing sections and missing key/value pairs in setup.cfg.

compare_different_keys(section, key, raw_actual: Any, raw_expected: Any) → Iterator[Tuple[int, int, str, Type]][source]

Compare different keys, with special treatment when they are lists or numeric.

dynamic_name_classes = {}
error_base_number = 320
error_prefix = ''
expected_sections: Set[str] = {}
file_name = 'setup.cfg'
fixed_name_classes = {}
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()

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

static get_example_cfg(config_parser: configparser.ConfigParser)str[source]

Print an example of a config parser in a string instead of a file.

get_missing_output(actual_sections: Set[str] = None)str[source]

Get a missing output string example from the missing sections in setup.cfg.

identify_tags = {}
classmethod load_fixed_dynamic_classes()None

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

missing_sections: Set[str] = {}
show_missing_keys(section, key, values: List[Tuple[str, Any]]) → Iterator[Tuple[int, int, str, Type]][source]

Show the keys that are not present in a section.

suggest_initial_contents()str[source]

Suggest the initial content for this missing file.

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

Warn about missing and different keys.

nitpick.plugins.setup_cfg.handle_config_file(config: Dict[str, Any], file_name: str, tags: Set[str]) → Optional[nitpick.plugins.base.NitpickPlugin][source]

Handle the setup.cfg file.

nitpick.plugins.setup_cfg.plugin_class() → Type[nitpick.plugins.base.NitpickPlugin][source]

You should return your plugin class here.