sdk icon indicating copy to clipboard operation
sdk copied to clipboard

dart fix with specific codes always applies pubspec related fixes

Open josh-burton opened this issue 6 months ago • 3 comments

This issues relates to the dart fix CLI command.

Dart fix supports supplying specific issue codes, to restrict the issues that the tool fixes and applies.

This works for dart related issues, but the tool seems to always apply pubspec related fixes, even when those codes are not specified.

Here is a sample demonstrating the problem: https://github.com/josh-burton/dart_fix_bug

To reproduce, run dart fix --apply --code=unused_import

Expected result: only the unused_import fix should be applied. Actual result: both the unused_import fix and the missing_dependency fix are applied.

  • Dart 3.8.1
  • MacOS

josh-burton avatar Jun 09 '25 01:06 josh-burton

Tagging @FMorschel from out Twitter conversation.

josh-burton avatar Jun 09 '25 01:06 josh-burton

WDYT @bwilkerson? Maybe this was intentional, but I'm not sure.

FMorschel avatar Jun 09 '25 10:06 FMorschel

I don't think that was intentional, but more importantly I think that's not the way the tool should work. I think it's confusing for users for the semantics to be different between .dart and .yaml files.

bwilkerson avatar Jun 09 '25 14:06 bwilkerson