loam 0.1.16
loam: ^0.1.16 copied to clipboard
Dart/Flutter: unused API, circular deps, boundaries, duplicates, complexity, catch, secrets, ignores, narrative/workflow/placeholder, stubs, assertions, resources, setState, a11y.
Changelog #
0.1.16 #
-
The HTML report has the loam.dev look.
loam scan --format htmlnow uses the website's brand: dark canvas, brand mark andloam.devwordmark in the header, the project name as the title, and a clear order — Health-Score, counts by severity and by rule, findings withfile:linein monospace, and the Fix-Prompt. Each finding now shows its remedy. The layout works from 375 px phones up to ultrawide screens (sticky overview and Fix-Prompt columns, finding cards side by side on very wide screens) and respects reduced motion. The report stays one offline file and embeds no font: it uses the brand fonts when they are installed and system fonts otherwise. -
New rule:
slop-undisposed-resource. Reports a field of a FlutterState(or of a class with its owndispose()) that the class creates itself - aTextEditingController,FocusNode,ValueNotifier,Timer.periodicand the like - but thatdispose()never releases. The field's resolved type must offerdispose,closeorcancel(close/cancelonly from the Dart SDK or third-party packages, soMenuController.close()does not count); a release indispose(), in a list or loop, with?.or in a helper method it calls counts as released. Values from parameters,widget.xor lookups are not reported. Part of thestrictprofile (warning); suppressible with// loam-ignore: slop-undisposed-resource - <reason>and baseline-able. -
New rule
slop-assertion-free-test(profilestrict, severity info): reports atest(…)/testWidgets(…)whose body never asserts — noexpect,expectLater,fail,verify*,check,expectAsync*,assertorthrow, neither in the body nor in a project function it calls (up to three hops). A call of a function-typed parameter or field counts as an assertion, so wrappers likeappTest(name, body)are fine. Tests withskip:are ignored. Own assertion helpers go underslop_assertion_free_test.assertion_functionsinloam.yaml. -
Fix: fingerprints no longer depend on line endings. Content anchors read multi-line string literals with their raw line breaks, so a CRLF checkout (Windows,
core.autocrlf=true) gave findings around such strings other fingerprints than an LF checkout, and a baseline written on one system reported them as new on the other. Line breaks inside tokens are now read as LF; fingerprints of LF files do not change. The placeholder-comment message quotes block comments with LF breaks too. -
loam gatemarks new findings. In the human output every finding line carries a baseline column:newfor findings missing frombaseline.json, blank for frozen ones, so a red ratchet names its cause. JSON and SARIF stay as they are (SARIF already hasbaselineState). -
Fix: fewer false alarms from the three accessibility rules.
a11y-icon-button-labelno longer reports anIconButtoninside aTooltip(message: …)or with anIcon(…, semanticLabel: …);a11y-image-labelno longer reports an image underSemantics(label: …),Semantics(excludeSemantics: true)orExcludeSemantics, and now also checks dot-shorthand images (Image logo = .asset(…));a11y-form-field-labelacceptsInputDecoration(label: Text(…)). The remedies name these options, and the form-field remedy sayshintTextis only a fallback. -
Fix:
unused-public-exportsno longer reportstoJson,toString,noSuchMethodandcall. Dart's core libraries call these without a static call site (jsonEncode(x)runsx.toJson()), so a missing reference does not mean they are unused. Members of enums, mixins, extensions and extension types are now recognised as part of their own declaration, like class members. -
Fix:
slop-empty-catchacceptscatch (_) {}. The wildcard is Dart's marker for "ignored on purpose" (the officialempty_catcheslint agrees), socatch (_) {}andon X catch (_) {}with a literally empty body are no longer flagged.catch (e) {}, a wildcard with a comment in the body andcatch (_, st) {}are still reported. The rule text now says plainly that the officialempty_catcheslint already covers the literal{}and that loam adds comment-only bodies and the project-wide gate. -
Fix:
complexity-hotspotscounts the Dart 3 constructs modern code branches with. Switch expressions (one point per arm, the_catch-all free), collectionif/forelements in lists, maps and sets,if (x case P when g)conditions and||/&&patterns now add to cyclomatic and cognitive complexity by the same rules as their statement and operator counterparts (collection elements and switch expressions nest likeif/for/switch). Complexity and theloam healthscore were too low for such code. The ruleset version changes (ruleset@…), and existing baselines may report newcomplexity-hotspotsfindings for functions that were just under a threshold: review them, then refreeze withloam baseline --update. -
Fix: sharper findings in five rules.
slop-unjustified-ignoreno longer reacts to/// ignore:doc comments or// ignore:text in strings, and now reports// ignore: type=lintwithout a reason.hardcoded-secretsfinds credentials in parameter default values ({this.password = '…'}); GoogleAIza…keys are a warning that asks you to restrict the key, because Google treats such keys as client identifiers.architecture-boundariesdocuments that only imports are checked, not exports.slop-unimplemented-stubtreats amixin classlike a mixin template.slop-narrative-commentflags a framed label only for a real frame (=== LABEL ===), no longer for comments such as// __init__ … __dispose__or**Note** … **bold**. -
Fix: Windows runs keep their analyzer store and leave no temp files. On Windows the analyzer's store flush does nothing, so a run that exited right away lost pending writes and left
*-temp-*files behind. loam now waits for the pending writes (at most one minute) before it closes the store and removes temp files older than an hour.loam watchnow reports changed files with forward slashes on Windows too. -
Fix: the HTML report opens on Windows when its path contains
&or^.--format htmlstarted the browser throughcmd /c start, which cut such a path at&and ran the rest as a command. It now hands the path to the Windows shell directly. -
Fix:
--format jsonand--format sarifkeep stdout a pure document. Summary lines and notes go to stderr for every machine-readable format, andloam gateprints an empty document when there are no findings, so the output can be piped straight into a parser. -
New rule:
slop-setstate-after-async-gap. ReportssetState(…)in a FlutterStatethat can run after the screen was closed: after anawait(also insidetry, or incatch/finallyof an awaitingtry), or in aFuture.then/whenComplete/catchErrorcallback, with nomountedcheck in between.if (!mounted) return;,if (!context.mounted) return;,if (mounted) …andmounted ? … : …count as guards. Only Flutter'sState.setStatecounts, resolved on the element model; a project's own wrapper such assafeSetStateis not reported. Unclear control flow is not reported either. Part of thestrictprofile (warning); suppressible with// loam-ignore: slop-setstate-after-async-gap – <reason>and baseline-able. -
New rule:
slop-tautological-assertion. Reportsexpect/expectLatercalls that cannot fail: a constant literal checked against a literal,equals(<constant>)or a constant matcher (expect(true, isTrue),expect(1, 1),expect(null, isNull)), or a value compared with itself (expect(x, x)). Only theexpectfrompackage:test,flutter_testormatchercounts, resolved on the element model. Collection literals with variables orforelements, records with identifiers andexpect(x, isTrue)are not reported. Part of thecoreprofile (warning); suppressible with// loam-ignore: slop-tautological-assertion – <reason>and baseline-able. -
New rule:
architecture-boundaries. Reportsimportedges that cross a forbidden layer boundary fromlayers:/boundaries:inloam.yaml: one finding per forbidden file-to-file edge at the import line, naming the importing layer, the target layer and both files, with a remedy that says how to invert the dependency. It reads only the configured architecture and never detects layers itself, so without boundaries it reports nothing. Part of thecoreprofile (it fires only for boundaries the project wrote down). Suppressible with// loam-ignore: architecture-boundaries – <reason>and baseline-able like any other rule. Layer directories may be written as./lib/core/orlib\core; an absolute path, the project root itself, or one outside the project is a config error. -
slop-unimplemented-stub: no false alarm for aPlatformInterfacechain across files. A class whoseextendschain leaves the file is now treated as a plugin platform interface when the first foreign superclass is named…Platformor the file imports a…platform_interfacelibrary. The rule stays on the parse path (no resolution); a missed stub is preferred over a false alarm. -
loam initdetects architecture layers and writes them toloam.yaml. From the well-known directories underlib/(core,domain,data,features...) it derives Layers and the forbidden Boundaries between them and writes both as visiblelayers:/boundaries:entries. Detection runs only ininit; a normal run never re-detects, and an existingloam.yamlis never overwritten. With fewer than two layers or no derivable boundary nothing is written. Thearchitecture-boundariesrule reports violations. -
Suppression audit: evaluation date and misplaced
until=. Thesuppressionobject in JSON and SARIF gainsevaluatedOn(YYYY-MM-DD, only when a// loam-ignore:directive has an expiry date), so a report states which day its expiry decisions were made on. Anuntil=written inside the reason text (instead of directly after the rule ID) is now reported as the new notice kindmisplaced-expiryrather than silently ignored; the directive stays valid. -
a11y-interactive-semanticsreports a swallowed name once, at the wrapper. A project widget that never routes a name toSemantics(label:), a tooltip or aTextinside its tapped area is now one finding at its class declaration, no matter how many call sites or forwarding wrappers use it; those call sites are no longer reported. A call that omits the name of a wrapper that does take one is still reported at the call. ATextnext to an unnamed icon button no longer counts as its name, and a field handed to a widget inside the tapped area (child:) leaves the wrapper unjudged. The fingerprint is anchored on the wrapper name, so a baseline may list the old call-site entries as stale (loam baseline --prune). Wrappers that swallow the name and build each other are reported once (at the one whose library URI and class name sort first) instead of not at all. -
Docs: platform-neutral hook and CI invocation. The pre-commit recipe and the CI guidance now use
dart pub global run loam …, which does not depend on where pub puts its shim (%LOCALAPPDATA%\Pub\Cache\binon Windows,~/.pub-cache/binelsewhere). -
Two new slop rules.
slop-placeholder-commentflags a comment whose whole text stands in for missing code (// ... rest of code,// ... existing code ...,// your code here); longer prose that merely mentions the rest of the code is never flagged.slop-unimplemented-stubflags functions, methods, getters and setters inlib//bin/whose entire body isthrow UnimplementedError()(matched by name on the parse tree, so slop-only runs stay parse-only), except template members of abstract/sealed classes and mixins,PlatformInterfacesubclasses, tests and generated files. Both arestrictprofile, so they never block the default gate. The third rule planned in #14, TODO without a reference, is not part of this change (open product question, see #76). -
Fix: member anchors name the class again (
Class.method). With the current analyzer AST the class body is its own node, so the owner lookup found nothing and findings in class members were anchored as justmethod; same-named methods of different classes in one file shared a scope. Affects thea11y-*rules andslop-empty-catch. Fingerprints of findings inside class, mixin, enum, extension and extension type members change once. Existing baselines report them as new plus stale: refresh the baseline withloam baseline --updateto adopt the new anchors. Top-level functions are unaffected. -
New command:
loam watchfor local iteration. Runs the full audit once, then again after every change to a Dart file,pubspec.yaml,analysis_options.yamlorloam.yaml, and prints what is new (+) and resolved (-). Every run analyses the whole project on top of the persistent analyzer store, so cross-file findings (cycles, unused exports, duplicates) match a fullloam scan. Bursts of saves become one run (--debounce, default 300 ms). SIGINT/SIGTERM end it cleanly with exit 0;--timeoutdoes not apply. Human output only. Changed files are named with/on every platform. -
Stale baseline entries are reported and can be removed.
loam gate(ratchet) names baseline entries whose finding no longer occurs, per rule, on stderr (the "gefixt" count).loam baseline --pruneremoves exactly those entries: it takes in nothing new, keeps the ruleset version and fingerprint scheme of the file and replacesbaseline.jsonatomically.loam gate --strict-baseline(orstrict_baseline: trueinloam.yaml; the flag overrides,--no-strict-baselineturns it off) makes stale entries turn the gate red, so CI can force the cleanup. With--staged/--since/--changedonly entries of the selected files count;--pruneis always project-wide and rejects--write/--update. -
Fix: test suite no longer needs a manual
pub getper fixture. Ten test files (circular dependencies, import graph, public API collector, unused public exports, agent-proof contract, project loader, complexity collector, progress sink, suppression audit) failed withLoadFileErroron any fresh checkout, first seen on Windows, because the gitignoredpackage_config.jsonof their fixture packages was missing. They now resolve the fixture themselves (test/support/fixture_packages.dart). Tests only. -
Fix: self-update locks have exactly one owner. The state and worker locks are now operating-system file locks (macOS, Linux, Windows) instead of a lock file with a timestamp. Two runs can no longer both take an expired lock, and a crashed run frees its lock by itself.
-
Faster resolving with a persistent analyzer store. The analyzer keeps its summaries of the SDK, the dependencies and the project's libraries in
.dart_tool/loam/analyzer/between runs, which roughly halves the resolve phase on a warm store. Results are identical with and without it; a damaged store is ignored, and if loading with it fails loam says so on stderr, deletes it and continues without it. The store is trimmed to 512 MB per project root (least recently used entries first). Switch it off with--no-cacheorcache: falseinloam.yaml. -
loam sloponly parses. When every active rule reads nothing but the file itself (hardcoded-secretsand the fourslop-*rules, e.g.loam slopor a config that leaves only those), the project is parsed instead of resolved, which takes a fraction of the time. Inline suppressions and their audit work as before. Behaviour change: in such runs files with semantic errors (an unresolved import, an undefined name) are now checked too; only syntax errors still exclude a file. -
Intended patterns are no longer reported.
code-duplicatesskips boilerplate methods (copyWith,==,hashCode,toString,toJson/toMap,fromJson/fromMap, equatableprops), recognised by name and form;unused-public-exportsalso respects@protected, the dependency-free marker@pragma('loam:reserved')and project annotations. Configure via the newcode_duplicates:(boilerplate,boilerplate_methods) andunused_public_exports:(annotations) sections inloam.yaml. -
--timing. Any analysing command prints wall-clock time per phase (setup, resolve or parse, rules, suppression, update-check; report forscan) and per rule to stderr, so a slow run shows where the time goes. stdout is unchanged. -
Fix: fingerprints no longer depend on running numbers (new fingerprint scheme 2).
slop-empty-catch,slop-unjustified-ignoreand thea11y-form-field-label,a11y-icon-button-label,a11y-interactive-semanticsanda11y-image-labelrules used an occurrence counter as anchor, so adding or removing one finding turned every later finding of that kind into a "new" one and forced baseline refreshes. The anchor is now the scope plus the normalised content of the flagged construct (formatting, comments and closure bodies do not count); a counter only separates truly identical findings in the same scope. Scope detection now also covers mixins, enums, extensions and extension types. Migration:baseline.jsonrecordsfingerprintScheme: 2. An older baseline keeps working: findings whose fingerprint changed are matched to baseline entries by rule, file and message, so the gate stays green and prints a one-time note. Runloam baseline --updateonce to upgrade the file. -
Suppressions are now auditable.
// loam-ignore:directives that suppress nothing (unused), have no reason or rule ID, name an unknown rule, or carry an invalid or expired date are reported as warnings byscanandgate, instead of being dropped silently. A directive can carry an optional expiry,// loam-ignore: <ruleId> until=YYYY-MM-DD – reason; after that day it stops suppressing and the finding returns. Reports show how many findings each rule had suppressed (json/sarifget asuppressionobject). The warnings never change the exit code and never enter the baseline: only findings decide the gate. -
A run never hangs silently:
--timeout.loamnow aborts a run that takes longer than 10 minutes (override with--timeout <duration>orLOAM_TIMEOUT, e.g.90s,30m,1h;0/offdisables it). The message on stderr names the phase and rule that was running and how to raise the limit; the exit code is124(distinct from1findings,64usage,78config), so a hook can tell a timeout from a red gate. stdout stays clean. Raised after aloam gatehung in a pre-commit hook under high load. -
Only report changed files:
--staged,--since <ref>,--changed.loam scanandloam gatecan narrow report and gate to the files git lists as changed, for example as a pre-commit hook (loam gate --staged) or a PR check (loam gate --since origin/main). The analysis stays project-wide so cross-file rules keep their full context; in ratchet mode the baseline diff is computed project-wide first, so unchanged files are never counted as fixed. Outside a git repository or with an unknown ref, loam exits with 64. -
a11y-interactive-semanticsreads your own wrapper widgets. A widget defined in the project whosebuild()routes a name toSemantics(label:), aTooltip, alabel/semanticLabel/tooltipargument or aText(also through further wrappers, up to four levels, each class analysed once) is accepted at its call sites, whatever the parameter is called. A wrapper that swallows its label is still reported, even when the call site passeslabel:. Wrappers that cannot be read keep the call-site check. -
Rule profiles:
coreblocks,strictis opt-in.loam gatenow blocks only on rules of the active profile.core(default) holds the rules with a near-zero false-positive rate:circular-dependencies,unused-public-exports,slop-empty-catch,slop-unjustified-ignore,hardcoded-secrets.strictadds the heuristic and threshold-based ones (comment slop,code-duplicates,complexity-hotspots,a11y-*). Findings of the other rules still run and appear as one hint line. Choose withloam gate --profile strictorprofile: strictinloam.yaml(CLI wins; unknown value: exit 64 / 78).baseline.jsonand theruleset@…hash do not depend on the profile. Behaviour change: a gate that only failed onstrict-profile rules is now green; setprofile: strictto keep the old behaviour. The website rules page shows the profile of each rule. -
Compact output for agents, fuller SARIF, distinct exit code. New
--format agentlists the highest-impact findings first (severity, rule, path, line) and stops at--max-findings(default 20,0= all); the last line says how many were left out and how to see them all. Other formats are unchanged and always list everything. SARIF now carriesruleswith help text,ruleIndex,partialFingerprints(the baseline fingerprint) and, inloam gate,baselineState(new,unchanged, andabsentfor fixed entries).loam gatewithout abaseline.jsonnow exits 66 instead of 1, so CI can tell "could not run" from "gate red". Exit codes are documented in the developer guide. -
Fix:
// loam-ignore:works on Windows. Eight rules (a11y-*andslop-*) reported finding paths with backslashes on Windows, while inline directives and baseline entries use forward slashes. No inline suppression matched there, so suppressed findings failed the gate as new. All rules now report project-relative POSIX paths on every OS. -
Auto-update, unless pinned. The update check left the hot path: it runs at most once a day in a detached background process, and the next run reports the result. A
dart pub global activateinstall and a standalone release binary now update themselves (the binary only after the archive matches the release's.sha256; releases now publish these files). Homebrew, source and git/path installs keep the notice with the right command. The first run after an update names the rules it added or removed, and a gate that turns red on a changed ruleset says so. Newloam.yamlkeys:required_version(pub constraint; never updated,loam gatestops with exit 78 on a mismatch) andauto_update: false; new environment variablesLOAM_NO_AUTO_UPDATEandLOAM_OFFLINE. CI detection now covers common CI variables beyondCI/GITHUB_ACTIONS. -
Fix: install channel of
dart pub global activateinstalls. loam ran as a snapshot under the Dart VM, so channel detection looked at thedartbinary; with a Homebrew-installed Dart SDK a pub install was reported as Homebrew. Detection now uses the snapshot path;loam --versionshows it. -
New rule:
hardcoded-secrets(slop). Flags plaintext credentials in string literals, offline and without any value leaving the rule. Two paths: known provider formats anywhere (AWS access key id, GitHub, Stripe live, Google API, Slack, Anthropic and OpenAI keys, PEM private keys with a key body; severity error) and credential-named sites (password,apiKey,clientSecret,authToken, ... as variable, named argument, assignment or map key) holding a high-entropy value (severity warning). Placeholders, env-var and storage-key names,String.fromEnvironment/Platform.environmentreads, tests, fixtures,example/, generated files andfirebase_options.dartare not reported. The value never appears in messages, reports, baseline or fingerprint; suppress with// loam-ignore: hardcoded-secrets - <reason>. -
Fix:
code-duplicatesfingerprints are now truly position-robust. The fingerprint used to include the start line of every copy, so adding a line above a duplicated block (for example a new field in a settings file) turned an existing finding into a "new" one and failed the gate. The fingerprint is now built from the clone's identity instead: the token count, a SHA-256 of the normalised token sequence, and the occurrence file paths. Line shifts keep a finding inkeptFindings; adding or removing a copy still changes it. Migration (once): the fingerprints of existingcode-duplicatesfindings change, so the firstloam gateafter upgrading reports them as new. Refresh the baseline once withloam baseline --updateand commitbaseline.json. TherulesetVersiondoes not change (it hashes rule IDs only), so the gate does not print its refresh hint in this case.
0.1.15 #
- Maintenance: dependency and CI upkeep, no rule/behavior changes. Bumped
analyzerto 14.3.0 (constraint widened, lockfile re-resolved), groupedpub/npmminor/patch dependency updates, andweb-vitals/vitestmajors verified compatible. Pinned the CI Dart SDK to the version the repo is actually formatted with, fixing recurringdart formatCI failures caused by thestablechannel drifting ahead of the repo's formatting.
0.1.14 #
- Fix:
a11y-interactive-semanticsno longer flags custom widgets that already carry their own accessible name. The rule previously suppressed a finding only when the call site was wrapped in aSemantics(label: …)ancestor — it never inspected the call site's own arguments. Two independent field reports (a widget that wraps itself inSemantics(...)internally, and a widget that delegates its label transitively to an already-excluded Flutter button) both turned out to pass their accessible name through alabel:argument on the call site itself. The rule now also accepts a non-emptylabel,semanticLabel, ortooltipnamed argument on the call site as a sufficient accessible name, covering both shapes without opening the target class's definition. An empty string ('') ornullstill does not count — the rule stays conservative.
0.1.13 #
- Fix:
ignoreglobs and the gate now suppress correctly no matter which directory you run loam from. Path-based suppression matched the ignore globs against a path that was accidentally resolved relative to the current working directory, so running loam from a directory other than the analysed project root — e.g.loam gate --project-root packages/appfrom a repo root, or any CI job whose working directory differs from--project-root— silently dropped allignore-glob suppressions. Findings you had deliberately excluded could reappear and fail the gate. Suppression is now matched against each finding's project-relative path directly and is independent of the process working directory. Inline// loam-ignore:suppression was unaffected.
0.1.12 #
loam.yamlis now discovered by walking up to your git repository root — and monorepo configs layer. Previously loam only read aloam.yamlsitting exactly at the analysed project root. Now it searches upward from that root to the enclosing git repository root (the directory holding.git), just like Dart's ownanalysis_options.yaml— so a config at your repo root is honoured even when you analyse a sub-package. Everyloam.yamlon the way is layered farthest→nearest: a repo-root file provides shared defaults and a nearer (per-package) file builds on top of it. Merge rules, nearer wins:rulesare merged per ruleId,ignorelists are concatenated (farther first, de-duplicated), andsource_dirs/update_check/a11yoverride while an omitted key inherits the farther value.ignoreglobs are still matched relative to the analysed project root, regardless of which layer declared them. The walk is bounded at the git root, so discovery stays repo-relative and reproducible across machines and CI — aloam.yamlabove the repository (e.g. in$HOME) is never picked up. With no git root, only<projectRoot>/loam.yamlis read. Fully backward compatible: a singleloam.yamlat the project root yields exactly the previous result.
0.1.11 #
- New: accessibility audits for Flutter — the
loam a11ycommand and four WCAG-grounded rules. loam.dev now ships ana11yrule category and a dedicatedloam a11ycommand (plus a--no-a11yopt-out on the broader scans) that flag missing accessible names and labels in Flutter widget trees. Every rule analyses the resolved element model — local classes that merely share a name with a Flutter widget are never flagged — and stays deliberately AST-only (runtime contrast, focus order and touch-target sizes are out of scope):a11y-image-label(WCAG 1.1.1) —Image/Image.asset/Image.network/.file/.memorywith nosemanticLabeland noexcludeFromSemantics: true; an explicit empty label still counts as missing.a11y-icon-button-label(WCAG 1.1.1 / 4.1.2) —IconButtonwith notooltipand no enclosingSemantics(label: …), plusGestureDetector/InkWellwhose direct child is a bareIcon.a11y-form-field-label(WCAG 1.3.1 / 3.3.2 / 4.1.2) —TextField/TextFormFieldwith neither anInputDecoration(labelText: …)(norhintTextas a fallback) nor an enclosingSemantics(label: …).a11y-interactive-semantics(WCAG 4.1.2) — generic and custom interactive widgets carryingonTap/onPressed/onLongPressbut noSemantics(label: …)ancestor. Flutter built-ins already covered by the sibling rules are excluded, so the two never double-report.
- New: the
loam slopcommand and the first three deterministic anti-AI-slop rules. A newsloprule category and aloam slopcommand surface the low-effort patterns AI agents commonly leave behind. All three are deterministic AST/token checks (no LLM, no token cost), skip generated files automatically, and are suppressible per project vialoam.yamlor inline with// loam-ignore: <rule> – <reason>:slop-unjustified-ignore(info) —// ignore:and// ignore_for_file:directives with no written justification, inline or on the preceding line.slop-empty-catch(warning) —catchblocks whose body is empty or contains only comments. Extends the built-inempty_catcheslint to the comment-only variant; bodies with arethrow,throwor any logging call are never flagged.slop-narrative-comment(info) —//comments immediately before a declaration that merely restate its name (// buildbeforevoid build()) or use a fixed narrative phrase (constructor,getter,setter,build method). Deliberately narrow:///Dartdoc and informative comments are never flagged — precision over recall.
- All seven new rules run in
loam scan,gateandbaselineand are visible in every reporter (human,json,sarif,markdown,html), with stable, line-shift-robust fingerprints so the baseline only reacts to genuinely new findings.
0.1.10 #
- New rule:
code-duplicates— loam.dev now finds copy-pasted and structurally identical code across your whole project. It enumerates code blocks over the resolved AST, normalises each into a token sequence, and clusters recurring blocks project-wide with a Rabin-Karp rolling hash. Every cluster becomes exactly one Finding (Severity.warning) that lists all locations and points at the first occurrence, with a stable Fingerprint so the Baseline survives line shifts and only reacts when a copy is added or removed. Generated files are excluded, and a conservative minimum-token threshold keeps short boilerplate out. Likecomplexity-hotspots, it scanslib/andbin/by default —test/,tool/andexample/duplicates are not reported unless you widensource_dirsinloam.yaml. It catches Type-1 (exact, whitespace- and comment-independent) and Type-2 (renamed identifiers and literals) duplicates; gapped duplicates are out of scope. The rule runs inloam scan,gateandbaselineand is visible in every reporter (human,json,sarif,markdown,html); suppress it per project vialoam.yamlor inline with// loam-ignore: code-duplicates. - Fewer false positives on Flutter widget code. The detector uses consistent (alpha) renaming — each distinct identifier and literal gets a stable per-block slot, preserving the repetition pattern — plus a distinct-token-type gate. Together they stop reporting structurally identical but semantically distinct widget boilerplate (parallel factories, builders and state widgets) as duplicates, while still catching genuine renamed copies. The hardening was validated on a real-world Flutter codebase: precision in production code improved with zero new missed duplicates.
0.1.9 #
unused-public-exportsnow reads the stack it runs on — far fewer false positives on real Dart and Flutter projects. The rule used to judge a throwaway app and a published package the same way, and it recognised only a handful of code-gen frameworks, so on real codebases it flagged deliberately public API and generated or annotated symbols as "dead". Three changes fix that. All of them read from the resolved element model (never source text), and each one only ever removes a false positive — upgrading can lower your finding count but never raises it, so the baseline/ratchet gate never paints a project red:- App vs. publishable package. loam reads the target's
pubspec.yamlonce at load. On a publishable package (anything withoutpublish_to: none) the deliberately public top-levellib/API is no longer reported as unused — that surface exists to be consumed from outside — while genuinely deadlib/src/internals are still reported. An app (publish_to: none) behaves exactly as it did before. Publishability is conservative: when it cannot be determined, loam assumes publishable. - Two more visibility annotations. Public members marked
@internal(package:meta) or@visibleForOverridingare no longer reported, joining the existing@visibleForTestingand@pragma('vm:entry-point')exemptions. - A wider code-gen registry. Symbols produced or annotated by six more
generators count as code-gen input instead of dead API:
injectable/get_it,auto_route,mockito, Isar, ObjectBox / floor and Hive — plus the generated suffixes*.gr.dart,*.config.dart,*.mocks.dartand*.pb.dart, on top of the existing*.g.dart/*.freezed.dart.
- App vs. publishable package. loam reads the target's
- New: a
stack:line inloam scan. Human-format scans print a one-line stack profile — the detected code-gen generators, whether it is a Flutter project, and publishability — so you can see at a glance what loam inferred about your project. It is purely diagnostic: it feeds the report and the publishable-vs-app decision but never makes a suppression call on its own. JSON, SARIF, HTML and Markdown output are unchanged.
0.1.8 #
- Complexity now scans
bin/too, and the scope is configurable. Thecomplexity-hotspotsrule andloam healthmeasured onlylib/, silently skippingbin/entrypoint logic (real, shipping code). They now measurelib/andbin/by default. Configure it per project withsource_dirsinloam.yaml— e.g. addtest/toolto widen, or narrow tolibonly. Generated files stay excluded regardless;test/,example/andtool/remain off by default (intentionally high or low complexity = noise). The structural rulescircular-dependenciesandunused-public-exportsare an inherentlib/concept and are deliberately unaffected. - Channel-aware update notice. The once-a-day update line now prints the
upgrade command that matches how loam was actually installed —
brew upgrade loamfor a Homebrew binary,dart pub global activate loamotherwise. This prevents the trap where a Homebrew user follows the generic pub.dev advice and installs a second, unreachable~/.pub-cachecopy that never shadows the Homebrew binary, so the "update" silently does nothing. - New:
loam --version. Prints the running version, the install channel and the resolved executable path (e.g.install: homebrew · …/Cellar/loam/…). Use it to confirm an upgrade actually landed on the binary on yourPATH. The version comes from the same constant the report footer uses, so the two can never disagree. The Homebrew formula'sbrew testnow asserts this version, catching a stale or mis-rendered formula. - Reports now surface suppression and scan scope. A
0 findings — cleanresult was indistinguishable from "nothing scanned" or "real findings knowingly suppressed". Every reporter now shows how many findings were suppressed (// loam-ignore:+loam.yamlglobs) and a scope line — files analysed (and how many underlib/), lines, and which rules ran — so a clean scan can be trusted as comprehensive. JSON is nowschemaVersion: 3with asummary.suppressedcount and ascanobject; SARIF carries the same in a run-level property bag; human/Markdown gain a scope line; the HTML report shows scope rows and a suppressed note. Findings and fingerprints are unchanged, so baselines do not churn.
0.1.7 #
- Fixed: Flutter SDK no longer crashes the scan. On a standard Flutter
install only
flutter/binis onPATH, wheredartis a wrapper script; loam resolved the SDK two levels up to the Flutter checkout root (which has nolib/_internal) and the analyzer crashed with a rawPathNotFoundException. loam now redirects into<flutterRoot>/bin/cache/dart-sdk. When no usable SDK can be found at all, loam prints an actionable message (setDART_SDK=…) and exits 78 instead of dumping a stack trace. - Agent-proof findings: every finding now carries a
kindand aremedy. loam's output is read by AI agents as well as humans, and a bare fact invites mis-triage.complexity-hotspotsnow distinguishesflutter-widget-buildfromlogic;circular-dependenciesstates the cycle is real regardless of any platform/strategy factory layered on top; every finding names the concrete next action. JSON output is nowschemaVersion: 2withkindandremedyas first-class fields; SARIF carries them in the property bag; Markdown gains a Remedy column. Fingerprints are unchanged, so baselines do not churn.
0.1.6 #
- New rule:
complexity-hotspots. Measures cyclomatic and cognitive complexity per executable over the resolved AST and flags hotspots that breach documented, conservative defaults (cyclomatic > 20 or cognitive > 30; a cyclomatic-only breach also requires cognitive > 5, so flat lookup tables and generated-style boilerplate stay quiet). Findings carry a stable fingerprint anchored on the qualified symbol name, so line shifts don't churn the baseline. Suppress individually with// loam-ignore: complexity-hotspots – <reason>. - New command:
loam health. A diagnostic aggregate view — Health-Score (0–100), Grade (A–F) and a descending hotspot table — rendered by its own terminal renderer. It always measures (independent of thecomplexity-hotspotsrule toggle) and is a report, not a gate: exit 0 even on a low score, exit 64 on a usage error. - New rule:
circular-dependencies. Detects import cycles across first-party Dart libraries (Tarjan strongly-connected components over the import graph); export-only re-exports are excluded so barrel files don't false-positive. - Positional project path.
scan,gate,health,initandbaselinenow accept the project root as a positional[path];-p/--project-rootoverrides it. - Fewer false positives. Flutter
gen-l10noutput is treated as generated and excluded from analysis. - Update notice (opt-out). Prints a one-line stderr notice (at most once a
day) when a newer release is on pub.dev; silence it with
--no-update-check, theLOAM_NO_UPDATE_CHECKenv var, orupdate_check: falseinloam.yaml. CI is always silent. - HTML report shows a Health-Score badge. When
loam scanemits HTML, a Score + Grade badge is rendered in the report head via a sidecar; the other formats and theReportPayloadcontract are unchanged. --format htmlnow writes a file and opens it. Instead of streaming to stdout, the HTML report is written toloam-report.html(override with--output <file>) and opened in the default browser on interactive runs. Auto-open is suppressed for piped/redirected output and under CI;--no-openskips it explicitly. The other formats (human/sarif/json/markdown) still stream to stdout unchanged.- Redesigned HTML report. Two-column layout with a sticky side panel that keeps the severity summary, the toolchain facts and the always-visible Fix-Prompt in view — no more scrolling to the page foot. Adds an inline brand mark, a terminal-styled masthead, a live search/filter across file, rule and message, and per-finding rule IDs that deep-link to the matching rule on getloam.dev. Footer and masthead link to the website, the repository and the sponsor page. The reporter stays a pure, byte-identical renderer.
0.1.4 #
- Documentation release (no functional changes). Adds an
example/so the pub.dev package page renders a usage example, and documents the full public API surface (Finding,Severity,Rule,ProjectLoader, …). Thepublic_member_api_docslint now keeps public-API documentation complete.
0.1.3 #
--format markdownis now available: a portable Markdown report alongsidehuman,sarifandjson.--format htmlis now available: a single self-contained, offlineloam-report.html(inline CSS/JS, no server, no CDN). Browse findings by rule, severity and file; select findings and copy a deterministic, versioned (prompt@ver) fix-prompt for an AI coding agent. The report is a pure renderer — no thresholds, no LLM calls. Redirect stdout:loam scan --format html > loam-report.html.- User-driven suppression via
loam.yaml. A project-rootloam.yamlnow drives per-rule toggles (rules:) and path-basedignore:globs (project- relative). A disabled rule is not run at all and changes therulesetVersion; glob-ignored files drop out of the audit entirely. Suppression acts before the baseline/gate and never fills the baseline or trips the gate. - Inline suppression
// loam-ignore: <ruleId> – reason. Suppress a single finding at its source on the same or immediately preceding line, via the analyzer comment model (not text regex). The reason is mandatory; only the named rule is suppressed. Distinct from the existing automatic codegen-input handling. loam initscaffolds a commentedloam.yaml(therules:+ignore:schema) and refuses to overwrite an existing file (exit 1).
0.1.2 #
--format jsonis now available: a stable, machine-readable JSON report (schema-versioned, with tool/ruleset metadata, summary counts and findings) for agent and tooling integration.markdownandhtmlremain on the roadmap.- Correct version everywhere. The tool version is now sourced from the
pubspec via a single in-code constant (
loamVersion) instead of a hard-coded string, so the scan footer and SARIF/JSON tool block always match the release. Adocs-attestcheck makes version drift across code and docs impossible.
0.1.1 #
- Run as a compiled binary. The analyzer needs a real Dart SDK at runtime;
as an AOT executable (Homebrew) none sits beside the binary, so
loam scancrashed with aPathNotFoundException. loam now resolves the SDK explicitly (DART_SDK, the Dart VM, or adartonPATH) and passes it to the analyzer — works both as a pub global binary and via the Homebrew tap. - Homebrew install (Apple Silicon macOS & Linux):
brew install silvio-l/loam/loam.
0.1.0 #
First functional preview. The walking-skeleton pipeline is real end to end:
loam scan— full audit via the tracer ruleunused-public-exports: finds project-wide unused public API (exports, classes, methods, getters/setters, fields) on the resolved Dart element model, not regex.loam baseline --write— freeze the accepted state tobaseline.json.loam gate— baseline/ratchet gate (default) and--absolutemode, with exit codes for CI.- Reporters —
human(default) andsarif(valid 2.1 for code-scanning). - Hardened against false positives on real Riverpod/Drift codebases (part-file references, extensions, setter writes, pattern destructuring).
Not yet implemented (wired in --help as "coming soon"): health, slop,
init, fix, and the json / markdown / html reporters. See the roadmap
in the repository.
0.0.2 #
- Polished pub.dev page: logo, badges and clearer sections in the README. No functional changes (still early development).
0.0.1 #
- Initial preview release (name reservation). Walking-skeleton CLI:
loam scan,loam gate,loam baselineare wired as stubs; the analysis pipeline and the tracer rule (unused-public-exports) are in active development. Not yet functional — see the roadmap in the repository.