Linter: The message for rule violations should contain the exact rule name

Created on 13 Nov 2015  Â·  1Comment  Â·  Source: dart-lang/linter

I find it hard to find the rule I want to disable (because I can't fix a violation for whatever reason)

example

/home/zoechi/dart/bwu_bind_html/lib/bwu_bind_html.dart 34:19 [lint] Specify type annotations.
.where((e) => e is! dom.ContentElement)
^

I couldn't find the rule name under s... where I expected, because it was under a... :-/ always_specify_types

The message should look like for example

/home/zoechi/dart/bwu_bind_html/lib/bwu_bind_html.dart 34:19 [lint] Specify type annotations [always_specify_types].
.where((e) => e is! dom.ContentElement)
^
or

/home/zoechi/dart/bwu_bind_html/lib/bwu_bind_html.dart 34:19 [lint] always_specify_types.
.where((e) => e is! dom.ContentElement)
^

with a way to get more verbose explanation like

dartanalyzer --explain=always_specify_types

always_specify_types
DO specify concrete types everywhere because bla bla ...

Most helpful comment

This is now fixed.

# From within mockito package, with `always_specify_types` in `analysis_options.yaml`
$ dartanalyzer lib/
...
  lint • Specify type annotations at test/utils.dart:10:3 • always_specify_types
  lint • Specify type annotations at test/verify_test.dart:41:9 • always_specify_types
...

>All comments

This is now fixed.

# From within mockito package, with `always_specify_types` in `analysis_options.yaml`
$ dartanalyzer lib/
...
  lint • Specify type annotations at test/utils.dart:10:3 • always_specify_types
  lint • Specify type annotations at test/verify_test.dart:41:9 • always_specify_types
...
Was this page helpful?
0 / 5 - 0 ratings