Skip to content

Use leancode_lint 28 with its analyzer plugin - #115

Merged
KamilSztandur merged 4 commits into
mainfrom
claude/compassionate-ritchie-5mg7sb
Oct 28, 2026
Merged

KamilSztandur merged 4 commits into
mainfrom
claude/compassionate-ritchie-5mg7sb

Conversation

@PiotrRogulski

Copy link
Copy Markdown
Member

Moves the package, the example app, the docs bundle and the landing page to leancode_lint 28, with its rules running as an analyzer plugin.

Package and example

  • leancode_lint 28 needs Dart 3.13, but it is only a dev dependency, so consumers are unaffected: the package still supports Dart 3.3 / Flutter 3.19.
  • analysis_options.yaml enables the leancode_lint plugin with cognitive_complexity on. The example has the same setup.
  • prefer_dot_shorthand stays off: the rule does not check the language version, and dot shorthands need Dart 3.10.
  • unsafe_variance is ignored: the controllers hold callbacks over their value type (validators, getValueSetter(), builders), so they are invariant in it by design, and satisfying the rule would change the public API.
  • Fixed the new findings: catch parameter names in lib/ (internal only), unneeded async in tests and the example, comments without a leading space in the example.

CI

  • flutter analyze leaves out analyzer-plugin diagnostics, so CI now runs dart analyze --fatal-infos. It also checks formatting.
  • The main job, the publish job and .fvmrc move to Flutter 3.47.8 (Dart 3.13). flutter pub publish resolves dev dependencies too, so publishing needs it.
  • A new job runs the package tests on Flutter 3.19.6, the lower bound in pubspec.yaml, with leancode_lint dropped. It uses dart pub get --no-example and flutter test --no-pub; the flutter variants still touch example/ and fail.
  • ⚠️ The job names change: "Flutter 3.29.x" becomes "Test and analyze", plus the new "Test on Flutter 3.19 (lower bound)". If branch protection requires the old name, it needs updating.

Docs bundle (docs_app/flutter)

  • Flutter 3.47.8 in docs.yml. It already includes Dart 3.13, so the separate Dart setup is removed. Analysis switches to dart analyze --fatal-infos.
  • The example generator (docs_app/scripts/flutter-examples.mjs) writes package imports in the registry, in dart format layout. The prelude ignores unnecessary_ignore next to unused_import, since most snippets use all three imports.
  • unsafe_variance is ignored for the Docs* field widgets, for the same reason as in the package. islandTheme ignores cognitive_complexity: its score comes from flat light/dark choices, not nesting.

Landing page

  • jaspr, jaspr_builder and jaspr_cli come from commit 9311973c of jaspr's next branch, whose builder supports analyzer 13 and newer. That removes the analyzer-12 caps on build_runner, build_web_compilers and dart_style, and the analyzer override. The commit is pinned in pubspec.yaml, analysis_options.yaml, docs.yml and README.md. Go back to version constraints once jaspr publishes a release with it.
  • jaspr_lints runs next to leancode_lint. prefer_dot_shorthand is on, since the landing page is on Dart 3.10+. All findings are fixed.
  • The rendered index.html only differs from before in the attribute order on the source-tab radio inputs. landing.js is identical.

Verified locally

  • Package: dart analyze --fatal-infos and formatting clean; package and example tests pass on 3.47.8. The package tests (285) also pass on 3.19.6 with leancode_lint dropped.
  • Docs: every step of the docs job passes, including npm run build.

Generated by Claude Code

Follows the setup in ciach: leancode_lint is a dev dependency on its latest
version and its rules run as an analyzer plugin, with cognitive_complexity
turned on. The Dart 3.13 that leancode_lint needs is only required to
develop the package; consumers never resolve dev dependencies.

- CI analyzes with `dart analyze --fatal-infos`, since `flutter analyze`
  leaves out plugin diagnostics, and checks formatting.
- A new `floor` job runs the tests on Flutter 3.19.6, the lower bound in
  pubspec.yaml, with leancode_lint dropped.
- The test and publish jobs and .fvmrc move to Flutter 3.47.8.
- prefer_dot_shorthand stays off: the package supports Dart 3.3 and the
  rule does not check the language version.
- unsafe_variance is ignored: the controllers are invariant in their value
  type by design, and satisfying it would change the public API.
- Fixed the new findings: catch parameter names, unneeded `async`, and
  comments without a leading space in the example.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KXYs8AHH4YLzzVwNqW3rEx
Both now enable leancode_lint's analyzer plugin, like the package.

docs_app/flutter:
- Flutter 3.47.8 in docs.yml. Its Dart is 3.13, so the separate Dart setup
  that the landing page needed is gone.
- CI analyzes with `dart analyze --fatal-infos`, since `flutter analyze`
  leaves out plugin diagnostics.
- The generator writes package imports in the registry, laid out the way
  `dart format` writes them, and also ignores `unnecessary_ignore` next to
  `unused_import` in the prelude, since most snippets use every import.
- unsafe_variance is ignored for the Docs* field widgets, as in the
  package; prefer_dot_shorthand stays off (floor is Dart 3.8).
- islandTheme ignores cognitive_complexity: its score is flat light/dark
  choices, not nesting.

landing:
- leancode_lint 28 with the analyzer-12 override kept for jaspr_builder;
  the analysis server builds the plugin in a package of its own.
- prefer_dot_shorthand is on (the landing page is on Dart 3.10+), with its
  22 findings fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KXYs8AHH4YLzzVwNqW3rEx
jaspr, jaspr_builder and jaspr_cli come from the commit of jaspr's `next`
branch that ciach's website uses (9311973c), whose builder supports
analyzer 13 and newer. That lifts the analyzer-12 caps on build_runner,
build_web_compilers and dart_style and the analyzer override, and lets
jaspr_lints run next to leancode_lint, with the same diagnostics as in
ciach. Its two findings are fixed: the source tabs use `input(...)`, and
the icon paths pass their children last.

The rendered page is the same apart from the order of the attributes on
the source-tab radio inputs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KXYs8AHH4YLzzVwNqW3rEx
@github-actions

Copy link
Copy Markdown

Docs preview: https://advanced-forms-fz6scek2d-leancode.vercel.app

Built from bed274f; the landing page is at /, the docs under /docs.

@PiotrRogulski
PiotrRogulski marked this pull request as ready for review October 27, 2026 15:52
@KamilSztandur
KamilSztandur merged commit f6073e2 into main Oct 28, 2026
6 checks passed
@KamilSztandur
KamilSztandur deleted the claude/compassionate-ritchie-5mg7sb branch October 28, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants