Skip to main content

Module import_hygiene

Module import_hygiene 

Source
Expand description

Import-hygiene lints — the pit-of-success guardrails that keep a project’s import blocks honest. An UNRESOLVABLE import is already a hard error at assembly (with a “did you mean” suggestion from the loader); this pass finds the problems that ASSEMBLE FINE but are still mistakes: an import that is never used, the same module imported twice, and a module importing itself.

The pass is deliberately separate from assemble_project so the assembler stays a pure Result-or-Err function; largo check runs this on top and surfaces the findings (warnings keep exit 0; errors fail).

Structs§

ImportLint
One import-hygiene finding.

Enums§

ImportLintKind
What kind of import-hygiene problem was found.
LintSeverity
The severity of an import lint. Warnings never block a build; errors do.

Functions§

lint_imports
Lint the entry file’s imports for unused / duplicate / self-import problems. Unresolvable imports are NOT reported here — the assembler already rejects those with a suggestion. Returns Err only if the entry can’t be read.
lint_imports_with_deps
lint_imports, resolving imports with the declared dependency roots so a path/git-local import is lint-checked too. dep_roots empty is identical to lint_imports.