lintforge 0.4.2
lintforge: ^0.4.2 copied to clipboard
LintForge is a pluggable static analysis tool for Dart and Flutter projects with an extensible runner, rule registry, and a standalone CLI you install globally.
Changelog #
Unreleased #
Changed #
- Promoted
unused_classto multi-file analysis so private class-like declarations can be kept alive by references from siblingpartfiles while still reporting only on files eligible for diagnostics. - Narrowed
unused_functionconditional branch exemptions to public branch API, so private helpers in branch files can still be reported. - Suppressed
unused_functionlocal-function diagnostics nested inside an unused enclosing executable already reported by the rule.
Fixed #
- Kept public enum constructors eligible for
unused_functiondiagnostics when no enum value invokes them.
0.4.2 - 2026-07-09 #
Features #
- unused_class: analyze across files (dd3d45f)
Bug Fixes #
- cli: reject unknown rule ids (78516e5)
- rules: report private extension members (dd18b3e)
- rules: share generated file detection (f323009)
- runner: match excludes from include roots (b08af2b)
- samples: make samples pure Dart (cb0cba5)
- unused_function: harden unused rule diagnostics (#55) (b92b0c1)
- unused_function: narrow branch and nested diagnostics (ff4ca9f)
- unused_function: report unused enum constructors (779ffec)
- unused-function: exempt public constructors (57cbd0e)
0.4.1 - 2026-07-08 #
0.4.0 - 2026-07-07 #
0.3.9 - 2026-07-04 #
0.3.8 - 2026-05-29 #
Features #
- cli: add --list-rules option to print registered rules (fdcd0e4)
- cli: add --list-rules option to print registered rules (#31) (2761611)
- hardening unused functions (#35) (251e696)
- unused_function: exempt constructors of freezed-annotated classes (ff79b39)
- unused_function: exempt constructors of freezed-annotated classes (#34) (1ef7ca2)
- unused: suppress nested findings inside unused source files (c972e32)
- unused: suppress nested findings inside unused source files (#36) (4a84f2c)
Bug Fixes #
- runner: exclude .dart_tool/ and build/ from analysis by default (b3973b3)
- runner: exclude .dart_tool/ and build/ from analysis by default (#33) (6456e5c)
- unused_function: exempt conditional-export and public-API members (fdd67eb)
- unused_function: exempt conditional-export/import branch targets (b7ad632)
- unused_function: exempt public members of public types outside lib/src/ (e9de657)
- unused_function: exempt supertype overrides without @override (dd40f83)
0.3.7 - 2026-05-28 #
Features #
- better utilization coverage (#30) (1b86e8f)
- multi_file_analysis_context: add reportableFilePaths field (6189773)
- reporter: group ConsoleReporter output by file (8c4bba5)
- reporter: group ConsoleReporter output by file (#28) (1880d63)
- samples: exercise excluded-file references in samples (9f3301c)
- unused_function: only emit diagnostics for reportable files (2c6ee3e)
- unused_source_file: only flag reportable files (13ad2ee)
0.3.6 - 2026-05-28 #
Features #
- function analysis enhanced (#26) (b0538b9)
- unused_function: normalise generic member identity in reference tracking (c19c502)
- unused_function: record enum-value declarations as uses of the enum constructor (b592b78)
- unused_function: record implicit super-constructor invocation as a use (ee2a5c1)
- unused_function: treat overrides of reachable supertype members as uses (c9f3c0e)
- unused_function: walk supertype chain for noSuchMethod exemption (a85e7e2)
Bug Fixes #
- unused_function: exempt flutter gen-l10n generated localization output (0c06c1f)
0.3.5 - 2026-05-28 #
0.3.4 - 2026-05-27 #
Features #
- sample projects (#17) (f120a92)
- samples: add unused_source_file sample project (af01ba7)
- unused functions (#20) (9f79e99)
- unused_function: add collector for class, mixin, enum, and extension-type members (c5574f2)
- unused_function: add collector for extension declaration members (ffa728a)
- unused_function: add collector for top-level getters and setters (3d4d3e7)
- unused_function: flag unreferenced public top-level functions in lib/src/ (07703ce)
Bug Fixes #
- analysis (ff4cf8c)
0.3.3 - 2026-05-27 #
0.3.1 - 2026-05-27 #
0.3.0 - 2026-05-27 #
Added #
- New default-on
unused_source_filerule. It flags Dart source files in the analyzed set that are never reached from any entry point via animport,export, orpartdirective. Entry points are files underbin/ortest/, files that declare a top-levelmain, andlib/<package>.dartplus any other file sitting directly underlib/(i.e. not nested insidelib/src/). Generated-file basenames such as*.g.dartand*.freezed.dartare skipped defensively even when the runner's default excludes are turned off. Diagnostics are emitted atSeverity.warning. The rule is registered by the built-in CLI and enabled automatically. Runningdart run lintforgeagainst a project that previously produced no diagnostics may now surface new warnings from this rule. - New
MultiFileAnalyzerRuleextension point for custom rules that need to reason across multiple files in a single invocation (for example to build an import graph or a cross-file symbol index). Multi-file rules are registered with the sameRuleRegistryasAnalyzerRuleimplementations and are dispatched once per run with the full set of resolved compilation units. ExistingAnalyzerRuleimplementations continue to be dispatched once per file and do not need any changes. - New
--no-default-excludesCLI flag that opts out of the built-in default exclude patterns. Pair it with explicit--excludeflags when you want full control over which paths are skipped. - New
LintforgeOptions.defaultExcludePathsconstant exposing the list of glob patterns excluded byLintforgeOptions.defaults(). Useful when composing customLintforgeOptionsinstances programmatically. - New default-on
unused_functionrule. It flags file-local function declarations that are never referenced, specifically private top-level functions in libraries that have nopartfiles and local function declarations inside another function or method body. Diagnostics are emitted atSeverity.warning. The rule is registered by the built-in CLI and enabled automatically. Runningdart run lintforgeagainst a project that previously produced no diagnostics may now surface new warnings from this rule. - New default-on
unused_classrule. It flags file-local declarations that are never referenced within the same compilation unit, coveringclass,mixin,enum, andextension typedeclarations whose names begin with_. The rule only runs against libraries that have nopartfiles and skips declarations annotated with@pragma('vm:entry-point'). Diagnostics are emitted atSeverity.warning. The rule is registered by the built-in CLI and enabled automatically. Runningdart run lintforgeagainst a project that previously produced no diagnostics may now surface new warnings from this rule. - Open-source project guidance, issue templates, pull request checklist, security policy, code of conduct, and Dependabot configuration.
- Coverage artifact upload to CI.
.pubignoreto keep automation and assistant-only files out of the published package archive..gitattributesfor predictable text file line endings.
Changed #
- Updated CI and release automation to target the repository default branch.
- Tightened package metadata for pub.dev discovery.
- Widened the analyzer dependency to
>=9.0.0 <13.0.0so projects usingfreezed >=3.2.5can addlintforgewithout a version-solver conflict. - Default exclude patterns now include
*.g.dartand*.freezed.dart. Pass an emptyexcludePaths(or--no-default-excludeson the CLI) to opt out. --excludenow layers on top of the default excludes instead of replacing them. Patterns you pass are added to the built-in defaults; use--no-default-excludesif you need to suppress the defaults.
Fixed #
- Fixed directory include discovery on Windows.
lintforgeis now installable alongsidefreezed ^3.2.5.dart run lintforge --versionnow prints the correct package version instead of the stale hardcoded0.1.0.- Restored analyzer 9.0.0 compatibility for the
unused_classrule. The rule previously reached intoExtensionTypeDeclaration.primaryConstructor, which only exists in analyzer 10+, causing a build break for consumers pinned to analyzer 9.0.0 ('primaryConstructor' isn't defined for the type 'ExtensionTypeDeclaration'). The rule now uses the cross-versionExtensionTypeDeclaration.nameaccessor. unused_classno longer crashes on analyzer 9.x/10.x. The rule previously readClassDeclaration.namePartandEnumDeclaration.namePart, which require the default-off experimental flaguseDeclaringConstructorsAst = trueand otherwise throwUnsupportedError, surfacing asRule unused_class threw during analysis: .... The rule now uses the always-availablenametoken on both nodes.
Commits #
0.2.0 - 2026-05-27 #
⚠ BREAKING CHANGES #
- api: Calculator is removed from the public API.
Features #
- add Severity, SourceLocation, Diagnostic value types (0b965cd)
- api: re-export public surface from lib/lintforge.dart (4cef459)
- cli: add bin/lintforge.dart CLI entry point (ae0fa3b)
- frame basics (44c400e)
- options: add LintforgeOptions value class (2c0cb6c)
- reporter: add Reporter abstraction and ConsoleReporter (85e556d)
- rules: add AnalyzerRule contract, AnalysisContext, RuleRegistry (0e45827)
- rules: add unused_class rule (4adcd8e)
- rules: add unused_function rule (84e9528)
- rules: register unused_function rule in CLI (2ea76c1)
- runner: add AnalysisRunner orchestrator and smoke test (b721079)
0.1.0 #
- Added a pluggable static-analysis framework for Dart and Flutter projects:
AnalyzerRule: abstract plugin contract for custom rules.Diagnostic,Severity,SourceLocation: value types describing analysis findings.AnalysisContext: carrier passed into each rule invocation, exposing the resolved compilation unit.RuleRegistry: in-memory registration and lookup of rules, with duplicate-id rejection.AnalysisRunner: orchestrator that resolves target files, dispatches rules, and collects diagnostics.LintforgeOptions: value class describing include/exclude paths and enabled rule ids.Reporter/ConsoleReporter: pluggable diagnostic output, with a stdout implementation.- CLI executable
lintforge(dart run lintforge) with--help,--version,--rules, and--excludeflags.
BREAKING CHANGE #
- Removed the
Calculatorstub that shipped in0.0.1. Consumers that depended on it must remove the import; it was a generator placeholder and not part of any intended public API.
0.0.1 #
- Initial package scaffold.