oxilean-lint
Static Analysis and Lint Rules for OxiLean
oxilean-lint provides a pluggable lint engine and a comprehensive set of built-in lint rules for analyzing OxiLean source code. It catches potential issues -- dead code, unused hypotheses, style violations, deprecated API usage, missing documentation -- early in the development cycle, before elaboration and type checking.
Because the linter operates on the surface AST produced by oxilean-parse, lint diagnostics are advisory: they can never affect kernel soundness. The engine supports auto-fixes, IDE integration, and a plugin system for user-defined rules.
17,600 SLOC -- fully implemented lint engine with built-in rules (121 source files, 315 tests passing).
Part of the OxiLean project -- a Lean-compatible theorem prover implemented in pure Rust.
Overview
Module Reference
| Module | Description |
|---|---|
framework |
Core engine: LintEngine, LintRegistry, LintRule, LintContext, LintDiagnostic |
rules |
Built-in rule implementations |
autofix |
Automatic source-code fix generation |
plugin |
Plugin API for user-defined lint rules |
ide_integration |
LSP-compatible diagnostic output |
Built-in Lint Rules
| Rule | Category | Description |
|---|---|---|
DeadCodeRule |
Redundancy | Detects unreachable definitions |
UnreachableCodeRule |
Redundancy | Detects code after unconditional returns |
UnusedImportRule |
Redundancy | Flags imports that are never referenced |
UnusedVariableRule |
Redundancy | Flags variables that are bound but never used |
UnusedHypothesisRule |
Redundancy | Flags hypotheses in proof contexts not used |
RedundantAssumptionRule |
Redundancy | Detects duplicate or trivially true hypotheses |
RedundantPatternRule |
Redundancy | Detects unreachable match arms |
SimplifiableExprRule |
Complexity | Suggests simpler equivalents for complex expressions |
LongProofRule |
Complexity | Warns when a proof exceeds a configurable line threshold |
NamingConventionRule |
Naming | Enforces camelCase / snake_case naming conventions |
StyleRule |
Style | General formatting and style guidelines |
MissingDocRule |
Documentation | Flags public declarations without doc comments |
MissingDocstringRule |
Documentation | Flags theorem statements without module docstrings |
DeprecatedApiRule |
Deprecation | Warns on use of deprecated definitions |
DeprecatedTacticRule |
Deprecation | Warns on deprecated or superseded tactics |
Lint Categories
Severity Levels
Each diagnostic carries a Severity:
Lint Passes
Rules are grouped into passes that run together:
use ;
let pass = new
.with_lint
.with_lint
.with_fixes;
Usage
Add to your Cargo.toml:
[]
= "0.1.1"
Running the Engine
use ;
let mut registry = default;
registry.register_builtins;
let engine = new;
let diagnostics = engine.lint?;
for diag in &diagnostics
Dependencies
oxilean-kernel-- core expression typesoxilean-parse-- surface AST types for rule traversal
Testing
License
Copyright COOLJAPAN OU (Team Kitasan). Apache-2.0 -- See LICENSE for details.