centrifugal / centrifuge-dart

Dart (Flutter) client SDK for bidirectional communication with Centrifugo and Centrifuge-based server over WebSocket
https://pub.dartlang.org/packages/centrifuge
MIT License
102 stars 29 forks source link

Linting #26

Closed synw closed 4 years ago

synw commented 4 years ago

Running the static analysis throws warnings and lints. I fixed some of them here:

There is also a deprecation warning to fix. And the question of the avoid_as setting: there are a lot of those to fix in the code. I suggest to remove this rule in static analysis: it is quite convoluted to fix and the as keyword is handy (I do not use this rule myself).

FZambia commented 4 years ago

@synw https://github.com/centrifugal/centrifuge-dart/tree/master/lib/src/proto folder contains autogenerated code, we can't just fix linting in it as it will be removed on next generate. It must be fixed in Dart Protobuf generator.

synw commented 4 years ago

I see. Then it maybe would be a good idea to remove the offending lints from analysis_options.yaml: annotate_overrides and avoid_as to get clean analysis results

About static analysis I recommend using strong mode's implicit-casts: false in addition to the existing implicit-dynamic: false if possible. Also using a standard settings base can be good: pedantic is a broadly used standard now (the pub.dev 's pana analysis uses it now). In addition I couldn't recommend enough extra_pedantic for stronger rules

FZambia commented 4 years ago

Yep, feel free to change this and send pr - I think this all makes sense if adopted by Dart community.

synw commented 4 years ago

Ok I'll check it out with pedantic enabled and maybe with implicit-casts: false to see what it does (this one is really bothering sometimes but it's my best friend vs runtime errors...)