Expand description
This module defines configuration structures, loading logic, and provenance tracking for rumdl. Supports TOML, pyproject.toml, and markdownlint config formats, and provides merging and override logic.
Structs§
- Config
- Represents the complete configuration loaded from rumdl.toml
- Config
Loaded - Marker type for configuration that has been loaded but not yet validated.
This is the initial state after
load_with_discovery(). - Config
Override - Config
Validated - Marker type for configuration that has been validated.
Only validated configs can be converted to
Config. - Config
Validation Warning - Represents a config validation warning or error
- Global
Config - Global configuration options
- Rule
Config - Represents a rule-specific configuration
- Rule
Registry - Registry of all known rules and their config schemas
- Sourced
Config - Configuration with provenance tracking for values.
- Sourced
Config Fragment - Represents configuration loaded from a single source file, with provenance. Used as an intermediate step before merging into the final SourcedConfig.
- Sourced
Global Config - Sourced
Rule Config - Sourced
Value
Enums§
- Config
Error - Errors that can occur when loading configuration
- Config
Source - Configuration source with clear precedence hierarchy.
- Markdown
Flavor - Markdown flavor/dialect enumeration
Statics§
- RULE_
ALIAS_ MAP - Compile-time perfect hash map for O(1) rule alias lookups Uses phf for zero-cost abstraction - compiles to direct jumps
Functions§
- create_
default_ config - Create a default configuration file at the specified path
- generate_
pyproject_ config - Generate default rumdl configuration for pyproject.toml
- get_
rule_ config_ value - Get a rule-specific configuration value Automatically tries both the original key and normalized variants (kebab-case ↔ snake_case) for better markdownlint compatibility
- is_
valid_ rule_ name - Checks if a rule name (or alias) is valid. Returns true if the name resolves to a known rule. Handles the special “all” value and all aliases.
- normalize_
key - Normalizes configuration keys (rule names, option names) to lowercase kebab-case.
- resolve_
rule_ name - Resolves a rule name to its canonical ID, supporting both rule IDs and aliases. Returns the canonical ID (e.g., “MD001”) for any valid input:
- resolve_
rule_ name_ alias - Resolve a rule name alias to its canonical form with O(1) perfect hash lookup Converts rule aliases (like “ul-style”, “line-length”) to canonical IDs (like “MD004”, “MD013”) Returns None if the rule name is not recognized
- resolve_
rule_ names - Resolves a comma-separated list of rule names to canonical IDs. Handles CLI input like “MD001,line-length,heading-increment”. Empty entries and whitespace are filtered out.
- suggest_
similar_ key - Suggest a similar key from a list of valid keys using fuzzy matching
- validate_
cli_ rule_ names - Validates rule names from CLI flags against the known rule set. Returns warnings for unknown rules with “did you mean” suggestions.
- validate_
config_ sourced - Validate a loaded config against the rule registry, using SourcedConfig for unknown key tracking.
- validate_
config_ sourced_ validated - Validate a config that has already been validated (no-op, returns stored warnings).