cherrypick_lint 4.0.0
cherrypick_lint: ^4.0.0 copied to clipboard
Analyzer plugin that catches CherryPick DI API misuse right in the IDE and in dart analyze: missing await on scope disposal, misused annotations, and runtime traps.
4.0.0 #
- Graduate package to a stable release. See pre-releases prior to this version for changelog entries.
4.0.0-dev.0 #
Pre-release. The major version now follows the cherrypick family
(cherrypick, cherrypick_annotations, cherrypick_generator are on 4.x). It
skips 2.x and 3.x, as those packages did. The stable 1.1.0 is already on
pub.dev; nothing here changes how the plugin is installed or which
rules exist — it is the same plugin, versioned to match the family.
- Built for
cherrypick4.x and usable with 3.x, whereavoid_extends_silent_observerdoes not apply (the fast path it warns about exists only in 4.x). Not for 2.x. Checked by running the plugin againstcherrypick2.2.0, 3.0.0, 3.0.2 and 4.0.0-dev.6; see "Whichcherrypickversions" in the README. avoid_extends_silent_observernow names 4.x in its message and notes that it can be disabled on 3.x.- Requires Dart >=3.10.0 (Flutter >=3.38).
Of the entries below only 1.1.0 was published to pub.dev; 0.1.0 and 1.0.0 were internal iterations in this repository, kept as history.
1.1.0 #
Two new rules for the @module requirements that codegen actually enforces,
and a correction to two existing ones. Verified by running
cherrypick_generator's moduleBuilder through build_test on each case.
- New
module_requires_part_directive(error, quick fix "Add the generated part directive"): a@modulelibrary must declarepart '<file>.module.cherrypick.g.dart';.moduleBuilderis aPartBuilder, so without it the build succeeds having written nothing and warns only in thebuild_runnerlog. - New
module_must_extend_module(error, no quick fix): a@moduleclass must haveModulein its supertype chain. The generated part isfinal class $Foo extends Foowhosebuilder()body callsbind<T>()— both come fromModule— so codegen emits a part that cannot compile, and reports nothing itself. module_method_missing_bindingno longer skips private methods, and now coversstaticmethods and operators.GeneratedClasscollectsClassElement.methodsfiltered only by!isAbstract, without a visibility check, soString _helper() => 'x';inside a@moduleclass fails the build exactly like a public method would. Getters and setters stay exempt: they are not part ofClassElement.methods. This means the rule reports on code it previously accepted.module_must_be_abstractkeeps itserrorseverity, but its message and documentation no longer claim the generator requires the modifier — it doesn't. The reason a concrete@moduleclass still cannot work is thatModule.builderis abstract: without an override Dart rejects the class, and with one the generator's validator rejectsbuilderas a method carrying neither@providenor@instance.
1.0.0 #
BREAKING: the plugin now runs on the official
analysis_server_plugin
framework instead of custom_lint, which changes how it is installed. What
each rule flags, with which severity and which quick fix, is unchanged.
- Install by naming the plugin in the top-level
plugins:section ofanalysis_options.yaml; it is no longer adev_dependency, andcustom_lintis not needed at all. - Diagnostics now appear in
dart analyze/flutter analyzeas well as in the IDE. The separatedart run custom_lintstep is gone. - Rules are disabled under
plugins: cherrypick_lint: diagnostics:instead ofcustom_lint: rules:. - Ignore comments take the plugin prefix:
// ignore: cherrypick_lint/<rule>. - Requires Dart >=3.10.0 (Flutter >=3.38), up from >=3.9.0 — that is the release which introduced analyzer plugins.
- Tests moved to
analyzer_testingunit tests; the// expect_lintfixture package became a plain installation example.
See the "Migration from 0.x" section of the README for the before/after table.
Why: custom_lint's repository is archived and its author no longer has
publishing rights, recommending analysis_server_plugin instead.
Verified from the same sources on both supported SDKs: analysis_server_plugin
0.3.14 / analyzer 12.1.0 on Dart 3.10.4 (Flutter 3.38.5), and 0.3.22 /
analyzer 14.3.0 on Dart 3.11.5 (Flutter 3.41.7).
0.1.0 #
- Initial release.
- await-rules:
avoid_unawaited_close_sub_scope,avoid_unawaited_close_scope,avoid_unawaited_scope_dispose, each with an "Add await" quick fix. - annotation-rules:
module_must_be_abstract(+ quick fix),module_method_missing_binding,inject_field_must_be_late_final(+ quick fix),named_value_must_not_be_empty,params_requires_provide. - runtime-trap-rules:
avoid_extends_silent_observer(+ quick fix),avoid_redundant_singleton_on_instance(+ quick fix),avoid_singleton_on_provide_with_params(no quick fix — the pattern can be intentional),avoid_resolve_in_to_instance(no quick fix — flagsscope.resolve()/resolveAsync()/tryResolve()/tryResolveAsync()inside.toInstance(...)/.toInstanceAsync(...), a documented runtime crash risk),avoid_precomputed_value_in_provide(no quick fix — flags a provider closure that just returns a value built outside it instead of constructing one, an unintended pseudo-singleton). - Fix:
avoid_extends_silent_observerand the three await-rules never seterrorSeverityexplicitly, so they silently reported asinfoinstead of the documentedwarning. All four now seterrorSeverity: ErrorSeverity.WARNING.