linter icon indicating copy to clipboard operation
linter copied to clipboard

Analyzer gives confusing directions (`combinators_ordering`)

Open johnmccutchan opened this issue 11 months ago • 4 comments

Given the following code:

import 'dart:io' as io show Directory, exitCode, Platform, stderr;

The analyzer will complain:

   info - engine_tool/lib/main.dart:6:24 - Sort combinator names alphabetically. Try sorting the combinator names alphabetically. - combinators_ordering

But the names are sorted alphabetically.

The fix:

import 'dart:io' as io show Directory, Platform, exitCode, stderr;

seems wrong as it isn't alphabetically sorted (P comes after e).

The analyzer should be specific that it wants you to sort according to the ascii/utf-8 value of the characters.

johnmccutchan avatar Feb 28 '24 21:02 johnmccutchan

Or the lint should be changed to use a case-insensitive comparison.

@pq

bwilkerson avatar Feb 28 '24 22:02 bwilkerson

I'd be in favor of case-insensitive comparison in this case.

pq avatar Feb 29 '24 00:02 pq

making that change will probably cause a bunch of existing code to be out of spec?

johnmccutchan avatar Feb 29 '24 01:02 johnmccutchan

It may very well. We'd want to do a bit of testing to measure impact first.

pq avatar Feb 29 '24 02:02 pq

Duplicate of https://github.com/dart-lang/linter/issues/3866

srawlins avatar Apr 29 '24 20:04 srawlins