kareki 0.7.0
kareki: ^0.7.0 copied to clipboard
A multi-package dead code detector for Dart and Flutter monorepos. Finds unused public APIs, files, and pub dependencies across Melos / pub workspaces.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.7.0 #
Added #
- Added
exclude.parameter_namesto suppressunused_parameterandunused_parameter_optionalfindings by exact parameter name across the workspace.kareki doctorreports configured names that no longer suppress a current finding. - Added a bilingual documentation site for the existing guides, with search, language switching, light and dark themes, and automatic GitHub Pages deployment.
- Added an operations guide for scheduling recurring dead-code cleanup pull requests with an AI agent.
Changed #
- Enforced 100% line coverage in CI and expanded regression coverage across the CLI, parser, entry-point resolution, and finding serialization.
- Improved the Japanese README and linked both READMEs to the hosted documentation.
0.6.0 #
Added #
- Support for Dart 3.13 primary constructors on classes, enums, and extension
types, including declaring fields, parameter usage analysis, enum constant
call-site tracking, and concise
new/factoryconstructor declarations.
Changed #
- Raised the minimum supported analyzer version from 9.0.0 to 10.2.0 while retaining Dart 3.10 as the minimum supported SDK.
- Added CI coverage for the minimum and latest supported analyzer versions.
0.5.0 #
Added #
- Support for Dart language features through Dart 3.12, including dot
shorthands, private named initializing formals, extension types, class type
aliases, records, and patterns. Extension type declarations and their
members now participate in
unused_elementanalysis.
Changed #
- Expanded analyzer compatibility from
^9.0.0to>=9.0.0 <15.0.0while retaining Dart 3.10 as the minimum supported SDK. - CI now runs the full test suite on every supported Dart minor version and the latest stable SDK.
- Added coverage reporting with octocov and strengthened regression coverage for malformed input, conditional directives, generated code, dependency modes, and false-positive-prone scenarios.
0.4.3 #
Added #
- Per-line suppression directive
// kareki: ignore=<rule|name>. A standalone comment targets the next non-blank, non-comment line; a trailing comment targets its own line. Complements the existing// kareki: ignore_for_file=...directive for cases where suppressing the whole file is too broad.kareki doctorreports stale per-line directives under the existingunused-ignore-directiveissue kind with the targeted line included as<path>:<line>.
0.4.2 #
Changed #
- Renamed the top-level
docs/directory todoc/to follow the pub package layout convention (singular). Internal links inREADME.md,README.ja.md, andexample/example.mdwere updated accordingly. No code or public API change. - Restructured
example/into a runnable minimum Dart package (example/pubspec.yaml,bin/,lib/,test/). Every file underlib/is wired so thatdart run kareki --root exampleproduces exactly one finding per rule — six in total — letting users see what each detector actually catches instead of reading a static sample.example/example.mdwas rewritten as a layout / per-rule walkthrough.
Added #
- CI step
Verify example/ exercises every rule(in.github/workflows/ci.yaml) backed bytool/verify_example.dart. Runs kareki againstexample/and asserts that every id inRuleId.allfires exactly once, so the example cannot silently drift out of sync with the detectors it is meant to demonstrate. Adding a new rule without updatingexample/now fails CI.
0.4.1 #
Added #
- New rule
unused_parameter_optional: flags optional parameters (named or positional optional) of a function, method, or constructor that are never passed by any call site in the workspace. This is the public / cross-package counterpart to Dart's built-inunused_element_parameter, which only inspects private optional parameters within a single library. Detection is based on simple-name call-site aggregation across every parsed file (generated files included as legitimate consumers). Inherits the same exemptions asunused_parameter—@override, abstract / external / native /UnimplementedErrorstub bodies, operators,this.x/super.x, the_/__placeholder convention, and any declaration kept alive by a configured keep-alive annotation. Suppress per file with// kareki: ignore_for_file=unused_parameter_optionalor globally viaignore.rules:inkareki-config.yaml.
0.4.0 #
Added #
- Japanese translations of the README and every page under
docs/(README.ja.md,docs/*.ja.md). Each English page now links to its Japanese counterpart and vice versa. (Retroactive entry for #5, which was merged without a changelog update.) - New rule
unused_parameter: flags parameters declared by a function, method, or named constructor that are never referenced in the body or initializers. Covers required and optional parameters, public and private — a strict superset of Dart's built-inunused_element_parameter(which only flags private optional parameters never passed at a call site). Skips@override, abstract / external / native callables, operators,this.x/super.x, the_/__placeholder convention, any declaration kept alive by a configured keep-alive annotation, and stub bodies whose only statement isthrow UnimplementedError(...)(federated pluginPlatformInterfacebase methods). Callback functions whose signature is constrained by a typedef (e.g. auto_routeCustomRouteBuilder/AutoRouteGroupconformers) are intentionally still flagged so the unused parameter is surfaced — rename to_to preserve typedef conformance while signaling intent. Suppress remaining cases via// kareki: ignore_for_file=unused_parameterorignore.rules: [unused_parameter]inkareki-config.yaml.
Changed #
- Top-level
README.mdhas been split into focused pages underdocs/(CLI reference, configuration, baseline, doctor, how-it-works). The root README now serves as a short overview with links into the detailed docs. (Retroactive entry for #5.)
0.3.0 #
Added #
- Baseline support — adopt kareki on an existing codebase without first
resolving every finding.
dart run kareki --baseline <path> --write-baselinesnapshots the current findings to a JSON file; subsequent runs that point at the same baseline (either via--baselineorbaseline:inkareki-config.yaml) suppress those findings from the output and the exit code, while any new finding still fails the run. The baseline file uses a<root>/placeholder for the workspace path embedded in eachstableId, so it is portable across machines and CI checkouts. Entries are sorted by(ruleId, stableId)for clean diffs. kareki doctornow reportsunused-baseline-entryfor any baseline entry whose(ruleId, stableId)no longer matches a current finding — the suppressed dead code has been deleted or relocated and the baseline is ready to be regenerated.
0.2.0 #
Added #
- New
kareki doctorsubcommand: validateskareki-config.yamlagainst the workspace and reports staleexclude.filesglobs,ignore.packages/ignore.dependenciesentries pointing at packages or deps that no longer exist, and// kareki: ignore_for_file=<rule>directives that suppress no actual finding. Only user-supplied entries are checked — built-in defaults are never flagged.textandjsonoutput formats are supported via--format.
Fixed #
// kareki: ignore_for_file=<rule>was silently no-op when the directive line was followed by a blank line and animportstatement (instead of another comment line). The regex used\sinside the rule capture, which let\nand subsequent source characters bleed into the captured value until a non-\w/\scharacter (typically the string quote in the nextimport 'package:...';) was reached; comma-split + trim then produced corrupted tokens that never matched any real rule id. The capture now stops at end-of-line.
0.1.1 #
Added #
- New rule
test_only_used: flags public declarations underlib/that are only reachable from test entry points (*_test.dart,test/,integration_test/). Detects the "code that exists only because its tests exist" anti-pattern that the standard reachability analysis misses because test files are themselves entry points. EntryPointSetnow exposesproductionRootNames/testRootNamesfor callers that need to distinguish production vs test consumption.ReachabilityBfs.computeaccepts an optionalfiltercallback so callers can constrain BFS traversal (used bytest_only_usedto keep production BFS from crossing into test source via shared simple names likemain).
0.1.0 #
Initial release.
- Rules:
unused_element,unused_file,unused_pub_dependency. - Multi-package workspaces via
melos.yaml/ pub workspaces. - Built-in presets:
freezed,json_serializable,riverpod,auto_route,go_router,drift,hive,meta. - Configuration via
kareki-config.yamlwith full override and custom preset support. - CLI:
dart run karekiwith--format,--packages,--rule,--strict. - Dart
>=3.10.0, analyzer^9.0.0.