In WebStorm I don't get any errors shown, but from console I get
(polymer1) $ dartanalyzer --no-hints _/_*.dart
Analyzing [bin/main.dart, lib/bwu_datagrid.dart, lib/libraries.dart, tool/grind.dart]...
[warning] Unsound implicit cast from Rectangleto Rectangle (/home/zoechi/dart/bwu_datagrid/lib/bwu_datagrid.dart, line 3402, col 36)
[error] The setter 'index' is not defined for the class 'int'. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 140, col 22)
[warning] Unsound implicit cast from Rectangleto Rectangle (/home/zoechi/dart/bwu_datagrid/lib/bwu_datagrid.dart, line 3402, col 36)
[warning] The argument type 'int' cannot be assigned to the parameter type 'String'. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 102, col 14)
[lint] Name non-constant identifiers using lowerCamelCase. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 28, col 15)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 29, col 3)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 32, col 3)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 33, col 3)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 38, col 10)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 57, col 12)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 69, col 5)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 70, col 5)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 101, col 12)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 121, col 16)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 121, col 26)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 125, col 18)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 126, col 5)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 130, col 10)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 131, col 7)
[lint] Specify type annotations. (/home/zoechi/dart/bwu_datagrid/lib/remote_model/remote_model.dart, line 149, col 10)
1 error, 3 warnings and 16 lints found.
analyzer:
strong-mode: true
exclude:
- lib/remote_model/**
linter:
rules:
- always_declare_return_types
- always_specify_types
# - avoid_as
- camel_case_types
- constant_identifier_names
- empty_constructor_bodies
- implementation_imports
- library_names
- library_prefixes
- non_constant_identifier_names
- one_member_abstracts
- package_api_docs
- package_prefixed_library_names
- prefer_is_not_empty
- slash_for_doc_comments
- super_goes_last
# - type_annotate_public_apis
- type_init_formals
# - unnecessary_brace_in_string_interp
- unnecessary_getters_setters
- package_names
Dart VM version: 1.16.0-edge.95f37e03afcc58ce035d5587cffc5fe57f0232ba (Wed Apr 6 16:08:39 2016) on "linux_x64"
Source of the project (Polymer1 branch)
https://github.com/bwu-dart/bwu_datagrid/tree/polymer1
Seems from the command line excludes from .analysis_options are ignored (even with --options=.analysis_options. Is there a way to make this work from command line?
dartanalyzer --no-hints --options=.analysis_options */**.dart
@pq
I wanted to point out that in WebStorm it works as expected, and WebStorm doesn't report analyzer warnings from excluded directories.
Is there a suggested workaround for this issue? Our CI tests run dartanalyzer to make sure that everything is in order and right now they always fail due to some generated libraries.
Thanks @enyo. The issue is that the exclude information in the options file is not getting properly processed in the command-line analyzer (though it is in the server which explains why it works in the IDE). There's not a great work-around at the moment unfortunately that doesn't include post-processing of analysis results on your end and that's pretty terrible. That said we are actively looking into this and expect to have it addressed in a dev build in the near term. Thanks for your patience in the meantime!
Thanks for your reply. Yes that's what I did now: I parse every hint/warning stdout and stderr output line and compare it with the exclude list in .analysis_options whether it should be ignored.
Looking forward to removing _that_ code again :)
@pq looks like flutter analyze may have just run into this, see @chinmaygarde's bug above.
looks similar to #25551, #26959
Giving this a nudge as it's impacting command-line linting:
https://github.com/dart-lang/linter/issues/389
@danrubel : I understand you're looking at migrating the CLI to using the new ContextBuilder and this would make sense to handle there?
@pq I'm guessing that @danrubel isn't going to be able to look at this anytime soon.
@devoncarew This is now blocking us from running dartanalyzer over the analyzer_cli package on the bots.
Which version of dart will ship with this analyzer fix?
Which version of dart will ship with this analyzer fix?
1.25.0-dev.5.0
We may need to back-port this to 1.24.2.
We may need to backport this to 1.24.2.
Not against it in theory...if we think it'll be helpful
It's not in 1.24.3, is there still a plan of getting this in before 1.25.0?
It's not in 1.24.3, is there still a plan of getting this in before 1.25.0?
Not likely. You'll have to get on the 2.0.0-dev train...
Most helpful comment
1.25.0-dev.5.0