dart-lang / dart_style

An opinionated formatter/linter for Dart code
https://pub.dev/packages/dart_style
BSD 3-Clause "New" or "Revised" License
649 stars 121 forks source link

Line longer than 80 characters in class type parameters #1568

Closed stereotype441 closed 1 month ago

stereotype441 commented 1 month ago

https://dart-review.googlesource.com/c/sdk/+/386736 introduces several declarations that look similar to this:

abstract interface class TypeAnalyzerOperations<
        TypeStructure extends SharedTypeStructure<TypeStructure>,
        Variable extends Object,
        TypeParameterStructure extends SharedTypeParameterStructure<TypeStructure>,
        TypeDeclarationType extends Object,
        TypeDeclaration extends Object>
    implements FlowAnalysisOperations<Variable, SharedTypeView<TypeStructure>> {
  ...
}

Note that the line TypeParameterStructure extends SharedTypeParameterStructure<TypeStructure>, is longer than 80 characters. The formatter insists on placing this text all on the same line, causing failures in the lines_longer_than_80_chars lint.

To see more examples, search for the text // ignore: lines_longer_than_80_chars in https://dart-review.googlesource.com/c/sdk/+/386736.

srawlins commented 1 month ago

That's the kind of bug that I'd be tempted to just turn a blind eye to. 😅

Half joking. This bug is the kind of thing that indicates, maybe the code isn't readable longer than 80 chars, and maybe it isn't readable wrapped into multiple lines; maybe there is a naming solution, or a typedef solution, that results in more readable code.