all2md.linter.config
Linter configuration.
LintConfig is the single frozen dataclass that controls which rules
run, at what severity, and with what rule-specific options. It is normally
populated from the [tool.all2md.lint] section of pyproject.toml (or
the equivalent [lint] section of .all2md.toml), but can also be
built programmatically.
- class all2md.linter.config.LintConfig
Bases:
CloneFrozenMixinFrozen configuration for a lint run.
- Parameters:
enabled_rules (frozenset[str] or None) – When set, only rules whose code appears in this whitelist run.
None(the default) means “every registered rule is enabled”.disabled_rules (frozenset[str]) – Rules to skip. Applied after
enabled_rules.severity_overrides (dict[str, Severity]) – Map of rule code to severity, overriding the rule’s
default_severity.rule_options (dict[str, dict[str, Any]]) – Per-rule option dictionaries, keyed by rule code. Forwarded to rules via
all2md.linter.rule.LintContext.config.severity_threshold (Severity) – Minimum severity to report. Violations below this level are dropped by the runner before results are returned. Defaults to
INFO(everything is reported).
- enabled_rules: frozenset[str] | None = None
- disabled_rules: frozenset[str]
- rule_options: dict[str, dict[str, Any]]
- is_rule_enabled(code: str) bool
Return True if the rule with
codeshould run under this config.
- get_severity(rule_cls: type[LintRule]) Severity
Return the effective severity for
rule_cls, honouring overrides.
- get_rule_options(code: str) dict[str, Any]
Return the option dict for
code(empty dict if none configured).
- classmethod from_dict(data: dict[str, Any] | None) LintConfig
Build a
LintConfigfrom a plain dict (as produced by the TOML loader).Recognised keys:
enable/enabled_rules: list of rule codes (whitelist)disable/disabled_rules: list of rule codes (blacklist)severity: dict of rule code -> severity namerules: dict of rule code -> per-rule options dictseverity_threshold: severity name (info/warning/error)
Unknown keys are silently ignored so config files can evolve without breaking older installs.