Skip to main content

Module config

Module config 

Source
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
ConfigLoaded
Marker type for configuration that has been loaded but not yet validated. This is the initial state after load_with_discovery().
ConfigOverride
ConfigValidated
Marker type for configuration that has been validated. Only validated configs can be converted to Config.
ConfigValidationWarning
Represents a config validation warning or error
GlobalConfig
Global configuration options
RuleConfig
Represents a rule-specific configuration
RuleRegistry
Registry of all known rules and their config schemas
SourcedConfig
Configuration with provenance tracking for values.
SourcedConfigFragment
Represents configuration loaded from a single source file, with provenance. Used as an intermediate step before merging into the final SourcedConfig.
SourcedGlobalConfig
SourcedRuleConfig
SourcedValue

Enums§

ConfigError
Errors that can occur when loading configuration
ConfigSource
Configuration source with clear precedence hierarchy.
MarkdownFlavor
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).