dart-code-checker / dart-code-metrics

Software analytics tool that helps developers analyse and improve software quality.
https://dcm.dev
Other
860 stars 266 forks source link

[New rule] Avoid using var #1203

Open mdeandrea-mrmilu opened 1 year ago

mdeandrea-mrmilu commented 1 year ago

Rule details

This rule should show warning when use var on code. The style guide for Flutter indicate to avoid using var on code, so that will be a nice rule to have

What type of rule is this?

Warns about a potential problem

Example code

BAD:

var x = 10; // LINT

String concat(int a, int b) {
  var c = 3; // LINT
  return a + b + c;
}

GOOD:

int x = 10;

final x = 10;

String concat(int a, int b) {
  int c = 3; // or final c = 3;
  return a + b + c;
}

Participation

Additional comments

No response