Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzer CLI ignoring analysis options excludes #26212

Closed
zoechi opened this issue Apr 7, 2016 · 16 comments
Closed

Analyzer CLI ignoring analysis options excludes #26212

zoechi opened this issue Apr 7, 2016 · 16 comments
Assignees
Labels
analyzer-command Issues with the command-line dartanalyzer tool analyzer-ux area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@zoechi
Copy link
Contributor

zoechi commented Apr 7, 2016

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 Rectangle to 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 Rectangle to 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

@kevmoo kevmoo added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Apr 7, 2016
@zoechi
Copy link
Contributor Author

zoechi commented Apr 7, 2016

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

@bwilkerson
Copy link
Member

@pq

@pq pq changed the title Analyzer different results in WebStorm and command line Analyzer CLI ignoring analysis options excludes Apr 7, 2016
@pq pq added bug P2 A bug or feature request we're likely to work on labels Apr 7, 2016
@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) bug labels Jun 15, 2016
@pq pq added P1 A high priority bug; for example, a single project is unusable or has many test failures analyzer-ux analyzer-command Issues with the command-line dartanalyzer tool labels Jul 25, 2016
@pq pq self-assigned this Jul 25, 2016
@enyo
Copy link

enyo commented Jul 28, 2016

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.

@pq
Copy link
Member

pq commented Jul 29, 2016

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!

@enyo
Copy link

enyo commented Jul 29, 2016

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 pq removed the P2 A bug or feature request we're likely to work on label Jul 29, 2016
@pq pq assigned bwilkerson and unassigned pq Aug 9, 2016
@eseidelGoogle
Copy link

@pq looks like flutter analyze may have just run into this, see @chinmaygarde's bug above.

@zoechi
Copy link
Contributor Author

zoechi commented Oct 20, 2016

looks similar to #25551, #26959

@bwilkerson bwilkerson added P2 A bug or feature request we're likely to work on and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Nov 29, 2016
@pq
Copy link
Member

pq commented Feb 8, 2017

Giving this a nudge as it's impacting command-line linting:

dart-lang/linter#389

@danrubel : I understand you're looking at migrating the CLI to using the new ContextBuilder and this would make sense to handle there?

@bwilkerson
Copy link
Member

@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.

@devoncarew devoncarew added P1 A high priority bug; for example, a single project is unusable or has many test failures and removed P2 A bug or feature request we're likely to work on labels Apr 10, 2017
kevmoo added a commit to grpc/grpc-dart that referenced this issue Jun 29, 2017
kevmoo added a commit to grpc/grpc-dart that referenced this issue Jun 29, 2017
kevmoo added a commit to grpc/grpc-dart that referenced this issue Jun 29, 2017
* Remove unused import
* Only analyze lib and test dirs
  - work-around for dart-lang/sdk#26212
* enable a few more lints
* remove unused field
@bwilkerson
Copy link
Member

https://codereview.chromium.org/2967883002/

@enyo
Copy link

enyo commented Jul 10, 2017

Which version of dart will ship with this analyzer fix?

@kevmoo
Copy link
Member

kevmoo commented Jul 10, 2017

Which version of dart will ship with this analyzer fix?

1.25.0-dev.5.0

@devoncarew
Copy link
Member

We may need to back-port this to 1.24.2.

@kevmoo
Copy link
Member

kevmoo commented Jul 13, 2017

We may need to backport this to 1.24.2.

Not against it in theory...if we think it'll be helpful

@enyo
Copy link

enyo commented Dec 21, 2017

It's not in 1.24.3, is there still a plan of getting this in before 1.25.0?

@kevmoo
Copy link
Member

kevmoo commented Jan 6, 2018

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-command Issues with the command-line dartanalyzer tool analyzer-ux area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

7 participants