Skip to content

fix(ci): upgrade analyzer to unblock analysis on current Dart - #15

Merged
btrautmann merged 3 commits into
mainfrom
bt/fix/dart-analyzer-upgrade
Sep 3, 2026
Merged

btrautmann merged 3 commits into
mainfrom
bt/fix/dart-analyzer-upgrade

Conversation

@btrautmann

Copy link
Copy Markdown
Contributor

Status

READY

Breaking Changes

NO

Description

CI has never actually run green on main. ci.yml was added by #11, and that PR's own checks ran the old per-package workflow files it deleted — so the new pipeline's first real execution was on a later PR, by which point it was already broken. This unblocks it.

Four independent failures, all pre-existing:

1. dart analyze fails with 7 errors on getDisplayString. The analyzer: ">=5.12.0" constraint was capped below 7.0.0 by source_gen 1.x, so it resolved to analyzer 6.4.1, where DartType.getDisplayString still requires withNullability. Newer 6.x releases aren't an option either — they depend on macros, which no longer ships with the Dart SDK. Analyzer 7+ is the only way forward.

This upgrades shape_generator to analyzer 10.x / build 4.x / source_gen 4.x and migrates to the new element model:

  • Read constructors, fields, methods and type parameters directly off ClassElement instead of a SimpleElementVisitor
  • parametersformalParameters, ParameterElementFormalParameterElement, isSyntheticisOriginImplicitDefault
  • Resolve constructor AST nodes via firstFragment
  • Treat new and null as unnamed constructor names, which is how the new model reports them

2. package_api_docs was removed in Dart 3.7.0 and now trips --fatal-warnings. Removed from analysis_options.yaml.

3. EquatableMixin is deprecated and trips --fatal-infos. Bumped equatable to ^2.1.0, where Equatable itself can be used as a mixin.

4. check_pana would newly fail for shape and shape_starter_kit once build goes green. Neither has a PANA_SCORE file, and verify_pub_score.sh silently falls back to demanding a perfect 160 when the score argument is empty. Recorded their actual scores (135 and 145) the way shape_generator already does.

The generator golden is also regenerated — dart_style 3.x reformats the output.

Relationship to other PRs

The analyzer work is a subset of #12, ported to keep this reviewable: #12 also reworks the shape/shape_generator APIs for v0.1.0, and none of that is here. Where #12's version of a change was entangled with that rework, this takes the smaller path instead — #12 deletes equatable outright and generates ==/hashCode, for example, where this just bumps the constraint.

Split out of #14 so that PR stays a one-file workflow change. #14 is red until this lands.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

🤖 Generated with Claude Code

The analyzer constraint (>=5.12.0, capped below 7.0.0 by source_gen 1.x)
resolved to analyzer 6.4.1 on current Dart SDKs, where
`DartType.getDisplayString` still requires `withNullability`. Newer 6.x
releases depend on `macros`, which no longer ships with the SDK, so the
only way forward is analyzer 7+.

Upgrade shape_generator to analyzer 10.x / build 4.x / source_gen 4.x and
migrate to the new element model:

- Read constructors, fields, methods and type parameters directly off
  `ClassElement` instead of a `SimpleElementVisitor`
- `parameters` -> `formalParameters`, `ParameterElement` ->
  `FormalParameterElement`, `isSynthetic` -> `isOriginImplicitDefault`
- Resolve constructor AST nodes via `firstFragment`
- Treat `new` and `null` as unnamed constructor names

Also:
- Remove `package_api_docs`, a lint removed in Dart 3.7.0
- Bump equatable to ^2.1.0 so `Equatable` can replace the deprecated
  `EquatableMixin`
- Regenerate the generator golden, which dart_style 3.x reformats
- Record pana scores for shape and shape_starter_kit, which otherwise
  default to requiring a perfect score

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
analyzer: ">=5.12.0"
build: ^2.4.1
equatable: ^2.0.2
analyzer: '>=10.0.0 <11.0.0'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to bump Dart >=3.9, in order for this to be compatible

@ClaireDavis ClaireDavis left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg!

@btrautmann
btrautmann merged commit c863a7a into main Sep 3, 2026
12 checks passed
@btrautmann
btrautmann deleted the bt/fix/dart-analyzer-upgrade branch September 3, 2026 20:42
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.

2 participants