Linter

The linter inspects an all2md AST Document and reports structural, heading, link, list, table, image, and typography issues via a rule-based engine. Because it operates on the AST, it works against every format all2md can parse. A subset of rules carry safe auto-fixes that the framework applies in place when the user passes --fix (or calls lint_and_fix_document from Python).

For CLI usage, rule catalogue, and --fix documentation, see Command Line Interface (Lint Command section) and Configuration Files ([tool.all2md.lint]).

Public Entry Points

all2md.linter.runner.lint_document

Lint an already-parsed Document.

all2md.linter.runner.lint_file

Parse file_path into an AST and lint it with config.

all2md.linter.runner.lint_and_fix_document

Lint and fix doc in place; re-lint and return the combined result.

all2md.linter.runner.lint_and_fix_file

Parse, lint+fix, and rewrite file_path.

all2md.linter.runner.LintRunner

Run a LintConfig over one or more documents.

all2md.linter.runner.LintResult

Result of linting a single document.

all2md.linter.runner.LintFixResult

Result of running lint --fix against a single document.

all2md.linter.config.LintConfig

Frozen configuration for a lint run.

Violations

all2md.linter.violations.Severity

Severity levels for lint violations.

all2md.linter.violations.Violation

A single lint violation emitted by a rule.

Auto-Fix Framework

Fixes are attached to violations via the Violation.fix field. The framework applies them through all2md.linter.fixes.apply_fixes() (or the LintRunner.lint_and_fix_* convenience wrappers). Rule authors call LintRule.build_violation() with a fix=LintFix(...) kwarg to attach a fix.

all2md.linter.fixes.FixSafety

Safety classification for an auto-fix.

all2md.linter.fixes.LintFix

A fix attached to a Violation.

all2md.linter.fixes.FixContext

Mutation primitives passed to LintFix.apply.

all2md.linter.fixes.AppliedFix

Record of a fix that was (or would have been) applied.

all2md.linter.fixes.apply_fixes

Apply every fix attached to violations whose safety is <= max_safety.

Rule Base and Registry

Every built-in and third-party rule subclasses LintRule and is registered with the process-wide rule_registry singleton. Plugins can register additional rules via the all2md.lint_rules entry point group (see Plugin Development Guide).

all2md.linter.rule.LintRule

Abstract base class for lint rules.

all2md.linter.rule.LintContext

Input passed to every LintRule.check() call.

all2md.linter.registry.RuleRegistry

Singleton registry mapping rule codes to LintRule classes.

The module-level all2md.linter.rule_registry instance is the preferred access point for the singleton — import it directly rather than instantiating RuleRegistry by hand.

Reporters

all2md.linter.reporters.Reporter

Abstract base for reporters.

all2md.linter.reporters.get_reporter

Return a reporter by short name.

all2md.linter.reporters.text.TextReporter

Render lint results in a ruff-style single-line-per-violation format.

all2md.linter.reporters.json_reporter.JsonReporter

Render lint results as JSON suitable for CI consumption.

Complete Module Reference