NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev
pub.dev, #2842 most downloaded on pub.dev
Algorithmic Cognitive Complexity calculation and Data-Flow analysis library and CLI tools for Dart and Flutter.
Latest stable
2.0.1
Last release 1 months ago
11 Oct 2026
Release timing varies
gaps range from 8 days to 6 weeks
Nearly every release is documented
notes for 17 of 17 stable releases
Nothing withdrawn
no release was ever pulled
3 months old
17 releases · first in 2026
Drag across the ruler to compare, or tap a release to open it.
Exempt non-static methods on private classes called across types, cross-file public/internal low-arity branching utility functions ( <= 2 parameters a
<= 2 parameters andCC > 0), and multi-line CC == 0 value formatters embedded inside stringShallowAnalyzer.Breaking: ShallowClassification (which gains siblingStep , below), SplitTier , and ControlFlowEscapeType are now final classes with static const value
ShallowClassification (which gains siblingStep, below),SplitTier, and ControlFlowEscapeType are now final classes withstatic const values instead of enums, so new values can be added in minorswitch statements and_) arm. .index is removed; name,values, toString(), label (where it existed), and == on the constantsshallow: a helper is now classified SIBLING_STEP when it is one step of a>= 2 leading camelCase name tokens with it_readProcEnviron / _readProcCwd), two or more share its leading verb_filterIgnored / _filterWorkspace / _filterOutdated), or one shares its_reportStaleShim / _reportUnknownSubcommand). Theother.parse()) are not siblings. SIBLING_STEP takesZERO_HEADROOM,SIBLING_STEP helpers are not absorbed into the caller's cumulative score and--fail-on-safe-inline or --only-safe, so the gate onlyShallowFinding.siblingSteps (sibling_steps in JSON),ShallowReport.siblingStepCount (sibling_step_count), a header count, and aFacts: siblings=[...] stay extracted line.file_split: name cuts by their type cluster, keep sibling types together,>= 50% of its naming lines is named<stem>_models.dart instead of after its longest declaration, unless a--target-lines and adds no boundary crossings. Siblingssibling type(s) … left in … note.inherited_cycles in JSON.Note: N inherited barrel cycle warning(s), M existing import cycle(s) carried over (informational)0 circular deps covers the plan'sSplitCluster.notes / SplitCluster.warnings /SplitCluster.inheritedCycles (JSON notes / warnings /inherited_cycles, emitted when non-empty) andDeclarationUnit.representationType (JSON representation_type).ShallowReport.toJson, FileSplitReport.toJson,DataFlowResult.toJson, DeltaSummary.toJson, and cognitive_complexity--max-file-lines --format json) now include 'schema_version': 1 at the topYour coding agent can read these notes before it upgrades. Set up the MCP server →
One column per month.
Breaking : Pruned legacy backward-compatibility aliases, re-export shims, and internal helper leaks from the public library surface ( api.txt ):
api.txt):
ShallowFinding.callerScore and the 'caller_score' JSON aliascallerCumulativeBefore / 'caller_cumulative_before').GitDiffService and isExcludedPath re-exports frompackage:cognitive_complexity/cognitive_complexity.dart, and removed thegitService parameter from the public DeltaAnalyzer constructor (sopackage:analytica is no longer leaked in api.txt).GitHubReporter, SignatureSynthesizer,DataFlowAnalyzer.synthesizer, SplitCluster.writeText,VariableUsage.copyWith, VariableUsage.declarationOffset,DeltaStatus.label, FileSplitAnalyzer.analyzeResolvedUnit,compareBySignificance, and kAskUserPartsPreferenceDirective) from thedata_flow --format json (DataFlowResult.toJsonVariableUsage.toJson) keys to 1-to-1 snake_case field namesstart_line, end_line, enclosing_declaration, is_cleanly_extractable,enclosing_score, slice_score_in_place, slice_score_at_root,estimated_enclosing_score_after, extraction_warnings,suggested_signature, is_mutated, declaration_line, andfirst_mutation_line, retaining 'file') to match cognitive_complexity,file_split, and shallow.file_split: Eliminated super-linear cone-merge overhead on densepart fallback cuts that would leave less than 25%largestResultingFileLines, meetsTarget, andhasSurvivingCoupledScc (largest_resulting_file_lines, meets_target, andhas_surviving_coupled_scc in --format json) to FileSplitReport, printsshallow: Weights multi-arm switch expressions and switch statements bymax(0, armCount - 1) when computing statement_count so lookup-tableMICRO_HELPER, excludesextension on T declarations as library-private (<extension on T>), and() parameters as at least 1 effective parameter.data_flow: Preserves transitive generic type parameter bounds in synthesizedinputs entries as mutated when reassigned via Dart 3(a, b) = ...), detects collection await for elements,await / yield inside nested function closures.cognitive_complexity 0.4.0
cognitive_complexity 0.4.0
FunctionComplexity gains a required composition
(ComplexityComposition record: branches, nesting, booleanOps,
maxDepth) and an isTestEntrypoint getter.cognitive_complexity: --format json declarations now carry composition
(branches, nesting, boolean_ops, max_depth; the first three sum to
score) and is_test_entrypoint (top-level main of a _test.dart file).
New --verbose / -v flag adds a Breakdown column and a
[test entrypoint] tag to the text table so a flat score-15 function is
distinguishable from a five-deep pyramid. Scores are unchanged.ShallowFinding also gains sharedParamSignatureWith,
sharedParamCount, paramsSubsetOfExistingType, and simulationIndex.shallow: findings carry two descriptive parameter facts that point at a
remedy other than inlining: shared_param_signature_with /
shared_param_count (a same-file declaration sharing >= 4 parameter names,
suggesting a shared parameter record) and params_subset_of_existing_type (a
same-file type whose instance fields cover >= 4 of the parameters,
preferring the enclosing type, suggesting that object be passed directly).
Text output adds a Facts: line when either is present.shallow: report ordering is now classification, then caller groups ranked by
their most significant finding (HIGH_ARITY/SIG_HEAVY before helpers that
change the caller's score, before +0 micro-predicates), then the caller,
then simulation order (simulation_index). Within one caller the printed
order matches the inline simulation, so a Caller CC: N (base B) line never
precedes the sibling that produced N. Previously findings were ordered by
estimated lines saved.ShallowFinding gains five required constructor parameters:
effectiveParameterCount, statementCount, callerZone,
inlinedCallerScoreIsolated, and headroomAfterInline. Code that only reads
findings from ShallowAnalyzer is unaffected.shallow: MICRO_HELPER now also fires for helpers with <= 2 statements
spanning up to 15 body lines, so formatter-wrapped one-liners no longer evade
it. The reason text includes the statement count.shallow: HIGH_ARITY is evaluated against the effective parameter count,
where record-typed parameters expand to their field count; the reason text
reports both (HIGH_ARITY(4 params, 6 effective)). Only inline record type
annotations expand, one level deep. A record typedef is a type declaration
like a class and counts as one parameter, so a domain record passed through a
helper is not reported as packing.shallow: CROSS_FILE_SINGLE_CALLER is no longer reported for lib/
declarations whose single caller lives in bin/, tool/, example/, web/,
or benchmark/ (package layering, not shallow extraction). Other reasons
still apply to such helpers. Helpers with a test/ caller are, as before, not
single-caller candidates at all.shallow: JSON findings gain effective_parameter_count, statement_count,
caller_zone, inlined_caller_score_isolated (caller base score plus this
helper's delta, independent of sibling simulation order), and
headroom_after_inline (max_caller_cc - inlined_caller_score). Text output
appends [isolated B -> I, headroom H] when sibling absorption made the
cumulative score differ from the isolated one.file_split: the extraction planner now measures its remaining budget against
the physical file length (imports, comments, and blank lines included) instead
of the sum of declaration lines, matching the estimated_remaining_lines it
reports. Files that were previously left over --target-lines with "No clean
extraction cuts recommended" now receive cuts.file_split: suggested filenames derive from the largest public declaration
in the cut rather than the first one in source order.file_split: a dominator-cone cut whose root declaration(s) merely bridge two
or more otherwise-disconnected groups of >= --min-cluster-lines each is now
emitted as one cut per group. Each root joins the group it has the most edges
into and undersized groups follow their callers; the bundled cut is kept when
the groups would import each other cyclically or would need more @internal
widenings than the bundle. A root that bridges several groups only names its
group when it holds at least a third of the group's lines. Rationale reads
Sub-component of the <root> cone.file_split: the oversized-class note for a surviving declaration now reports
its declared supertype and override ratio, e.g.
implements StorageAdapter (32/51 members are @override), and when at least
half of the members are @override it states that the class size is bound by
the interface surface instead of advising that static methods be promoted.
extends X is reported the same way; mixins are not. DeclarationUnit gains
memberCount, overrideMemberCount, supertypeLabel, and an
isInterfaceBound getter (member_count, override_member_count,
supertype in JSON).file_split --format json always emits a JSON array with one
report per analyzed file. Previously a single matching file produced a bare
object and zero or several files produced an array.shallow classifies a helper whose inlining lands the caller
exactly on --max-caller-cc as ZERO_HEADROOM instead of SAFE_INLINE
(ShallowClassification.zeroHeadroom, ranked between SAFE_INLINE and
FLATTEN_AND_INLINE). SAFE_INLINE now requires the caller to stay strictly
below the ceiling. ZERO_HEADROOM helpers are not absorbed into the caller's
cumulative score for later siblings and do not count toward
--fail-on-safe-inline or --only-safe. Reports gain zero_headroom_count
and the text header lists the count.cognitive_complexity 0.3.0
cognitive_complexity 0.3.0
ShallowFinding gains two required constructor parameters,
callerBaseScore and callerCumulativeBefore. Code that only reads findings
from ShallowAnalyzer is unaffected; code constructing ShallowFinding
directly must pass both.shallow: when several single-caller helpers share one caller, the caller's
score was reported as a running cumulative total with no way to recover the
caller's real static score. Each finding now reports caller_base_score (the
caller's static score) alongside caller_cumulative_before (the simulated
score after earlier SAFE_INLINE siblings were absorbed). caller_score is
retained as an alias of caller_cumulative_before. Text output renders
Caller CC: 6 (base 3) -> 9 after inline (+3) whenever the two differ.cognitive_complexity: with --max-function-lines, the text table and the
--git-diff text table now include a Lines column, and every violation
marker names its trigger, e.g. [VIOLATION: score > 15],
[VIOLATION: lines > 60], [VIOLATION: score > 15, lines > 60], or
[VIOLATION: increased] under --fail-on-increase. Consumers matching the
bare [VIOLATION] token on stdout should match the [VIOLATION prefix
instead. JSON output is unchanged.Auto-discover default targets when no positional paths are given: Pub workspace members ( <member>/lib ), single-package lib/ , or packages/*/lib / pk
<member>/lib), single-package lib/, or packages/*/libpkgs/*/lib monorepo layouts. The GitHub Action targets input now--git-diff delta tables by review significance in every format (steptext, json): violations first, then new scoreDeltaAnalyzer.computeDeltas gains failThreshold, maxFunctionLines, andfailOnIncrease parameters and the comparator is exposed ascompareBySignificance (#53).Omit zero-complexity ( delta == 0 , score == 0 ) added and removed declarations from --git-diff Markdown, CLI, and JSON delta tables (unless they trig
delta == 0, score == 0) added and removed--git-diff Markdown, CLI, and JSON delta tables (unless--max-function-lines), add DeltaSummary.countRemoved (🗑️),Score cells as _new_ -> **N** andN -> _deleted_.shallow CLI (dart run cognitive_complexity:shallow) andShallowAnalyzer (ShallowReport, ShallowFinding, ShallowClassification)HIGH_ARITY, MICRO_HELPER,SIG_HEAVY, CROSS_FILE_SINGLE_CALLER) and simulate exact nesting-awareSAFE_INLINE,FLATTEN_AND_INLINE, LOAD_BEARING).DataFlowAnalyzer and DataFlowResultcognitive_complexity:data_flow) with nesting-aware complexity impactenclosingScore, sliceScoreInPlace, sliceScoreAtRoot,estimatedEnclosingScoreAfter) and extractionWarnings when a proposed slice>= 5 input parameters or provides low complexity payoff.--max-file-lines and --max-function-lines CLI flags and GitHubmax-file-lines, max-function-lines) with --git-diffFileLineMetric, FileLineDelta). Disablednull) by default to preserve full backward compatibility.// cognitive_complexity:ignore (per-declaration) and// cognitive_complexity:ignore_for_file (file-wide) suppression commentCommentDirectiveParser.file_split CLI (dart run cognitive_complexity:file_split) andFileSplitAnalyzer (analyzeFile / analyzeFiles) to compute acyclic file<= 800-line subsystems using Tarjan'sstatic method promotion and embedded>75%) detection for oversized classes, multi-file and--[no-]use-parts support, and zero-churnexport ... show barrel generation.--comment-output file entirely when a run has zero$GITHUB_STEP_SUMMARY. A diff that only improvesDeltaSummary.isClean(), the predicate behind that decision.--comment-output is only requested when the scannergithub format against a diff base.--exclude and --[no-]ignore-generated CLI options to configurePathFilter.pathFilter parameter to ComplexityAnalyzer and DeltaAnalyzer.::warning annotations on non-violating::error) while full deltas remain tracked in step summaries and PR commentensure_cli_readme_test.dart to verify CLI --help documentation inREADME.md.README.md to reference modularpackages/cognitive_complexity) and add rendered ActionFix action.yml monorepo auto-detection to evaluate default lib vs packages existence against the caller's $GITHUB_WORKSPACE instead of $ACTION_PATH (
action.yml monorepo auto-detection to evaluate default lib vspackages existence against the caller's $GITHUB_WORKSPACE instead of$ACTION_PATH (#76).action.yml to run the scanner from the caller's $GITHUB_WORKSPACE$ACTION_PATH, so relative targets and --git-diff resolve--comment-output and --max-comment-rows CLI options: with--format=github, write a second report capped to the most significant rowscommentFile and maxCommentRows parameters to GitHubReporter.max-comment-rows input to the GitHub Action (default 0 = unlimited)packages/cognitive_complexity.action.yml and skills/ structure for monorepo workspace.Fix data_flow crashing with PathNotFoundException when run as a standalone AOT executable ( dart run cognitive_complexity:data_flow@ / dart install ),
data_flow crashing with PathNotFoundException when run as adart run cognitive_complexity:data_flow@ /dart install), where SDK auto-discovery resolved to the app bundle--sdk-path, set DART_SDK,PATH) instead of handing the analyzer an unresolvedPATH-based discovery the Flutter checkout layout: aflutter/bin/dart wrapper script now resolves toflutter/bin/cache/dart-sdk.FLUTTER_ROOT discovery fallback.--sdk-path option to the data_flow CLI (plumbed to theDataFlowAnalyzer.sdkPath parameter); invalid explicit paths--fail-on-increase ignoring --fail-threshold: when both are set,--fail-threshold, the strict any-increase ratchet isdart-cognitive-complexity agent skill:
this) must bestatic methods) rather thanRemove accidental export of internal CognitiveComplexityVisitor from package:cognitive_complexity/cognitive_complexity.dart.
CognitiveComplexityVisitor from
package:cognitive_complexity/cognitive_complexity.dart.Streamline README.md into a focused, scannable TL;DR.
README.md into a focused, scannable TL;DR.doc/:
doc/scoring.md: Scoring matrix, nesting multipliers, and Dart 3 AST rules.doc/cli.md: Command-line options, git diff delta evaluation, and CI ratcheting.doc/data_flow.md: Statement data-flow analysis, method extraction theory, and programmatic API.doc/github_actions.md: Complete GitHub Action workflow setup, parameters, and fork security permissions.Introduce data_flow analysis tool and library (package:cognitive_complexity/data_flow.dart):
data_flow analysis tool and library (package:cognitive_complexity/data_flow.dart):
DataFlowAnalyzer to extract reaching definitions (inputs), variable mutations, and live outputs for arbitrary statement slices.SignatureSynthesizer to automatically generate Dart 3 Record method signatures (({TypeA a, TypeB b})).data_flow CLI with agent-first JSON formatting by default and formatted text reports.(a, b) = (b, a)), pattern
variable declarations, labeled break/continue targeting outside the
slice, rethrow whose catch lies outside the slice, mutations of
captured variables inside nested closures, and constructor initializers.ControlFlowEscapeType.closureEscape, rethrowEscape, and
constructorInitializerEscape.await for async-ness, use use-site static types
(preserving promotion), include enclosing type parameters with their
bounds, and sanitize/deduplicate record field names.Update the dart-cognitive-complexity agent skill: anti-goodhart 3-tier decomposition rubric with deterministic tier selection via the data_flow CLI, a
dart-cognitive-complexity agent skill: anti-goodhart 3-tier
decomposition rubric with deterministic tier selection via the data_flow
CLI, and a gated Tier 3 method-object reference
(references/method-object.md) absorbed from kevmoo/kevmoo_skills.Refine the skill's 3-Tier Decomposition Rubric per empirical feedback ( #19 ):
queue + visited) without weakening the Tier 3 gate (stays at >= 3Result dataclasses reserved for public API boundariesdata_flow signature synthesizer).enum/sealed) instead of boolean control-flow flags; ordered_Runner facades,Broaden analyzer compatibility to support versions 12.x through 14.x.
analyzer compatibility to support versions 12.x through 14.x.Scoring fixes aligning with the SonarSource Cognitive Complexity whitepaper (v1.7) and its reference implementation (sonar-java):
Scoring fixes aligning with the SonarSource Cognitive Complexity whitepaper (v1.7) and its reference implementation (sonar-java):
else if chains no longer deepen nesting: branch contents sit one level
below the head if (previously each chain link added an extra level).switch statements/expressions and catch clauses now receive the
standard nesting increment when nested (previously flat +1).show, on, ...) are no
longer skipped.get /set prefix,
matching class members.--fail-on-increase no longer flags newly added declarations (they have
no baseline); they are governed by --fail-threshold alone..git, .dart_tool, build) now matches whole path
segments, so .github/ and similar directories are scanned correctly.Initial release of core utilities, SDK discovery, Git integration, and CI reporting.
pkg:dedupe:
--ignore-comments, --ignore-literals, --ignore-identifiers).--cache, --cache-dir, --clear-cache).--git-diff, --only-changed).CloneInstance, DuplicateCluster, DedupeReport) with full JSON serialization.bin/dedupe.dart).// undead:ignore and// undead:ignore_for_file.