googlearchive / pedantic

How to get the most value from Dart static analysis
https://pub.dev/packages/pedantic
BSD 3-Clause "New" or "Revised" License
324 stars 56 forks source link

prefer_single_quotes needs an automatic fix #47

Closed Pacane closed 4 years ago

Pacane commented 4 years ago

Since this rule is enabled by default in pedantic, my project has more than 6000 warnings.

Would it be an option to add a dartfmt fix for this, as there's no easy way to change it for us without analyzing each occurrence for an escaped single quote in the strings.

bwilkerson commented 4 years ago

Yes. The fix for prefer_single_quotes was added on 12/20.

In order to use it you'll need a version of the analysis server that's newer than that. Because the analysis server is shipped with the SDK, that typically means a version of the SDK that newer. I don't know whether there has been a release of the SDK since that date.

awhitford commented 4 years ago

How does one use the "fix"? I tried running dartfmt, but it does not address this issue. I am using Dart version 2.8.4 and Flutter version 1.17.3.

Pacane commented 4 years ago

Use the package dartfix, it contains the fix for that in the latest version

On Sun., Jun. 7, 2020, 15:02 Anthony Whitford, notifications@github.com wrote:

How does one use the "fix"? I tried running dartfmt, but it does not address this issue. I am using Dart version 2.8.4 and Flutter version 1.17.3.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dart-lang/pedantic/issues/47#issuecomment-640264147, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVCNSDHSZLBI3WVMFPTLQDRVPP6DANCNFSM4KGW4I4A .

bwilkerson commented 4 years ago

The fixes are also available in many editors, such as IntelliJ and VS Code.

Pacane commented 4 years ago

Last time I checked it wasn't available in IDEs (the one to bulk fix quotes in multiple files), I could only find the fix within dartfix

On Sun., Jun. 7, 2020, 19:06 Brian Wilkerson, notifications@github.com wrote:

Closed #47 https://github.com/dart-lang/pedantic/issues/47.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dart-lang/pedantic/issues/47#event-3417359918, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVCNSDOO4M3AS3TQT2ZQYLRVQMONANCNFSM4KGW4I4A .