Skip to content

analysis_options's exclude is not respected with parts #34717

@a14n

Description

@a14n

Tested with 2.0.0 and 2.1.0-dev.5.0 and the following files:

  • analysis_options.yaml:
analyzer:
  exclude:
  - '**.g.dart'
linter:
  rules:
  - unnecessary_new
  • lib/a.dart:
part 'a.g.dart';
final a = new List();
  • lib/a.g.dart:
part of 'a.dart';
final b = new List();

I get the result:

$ dartanalyzer .
Analyzing test...
  lint • Unnecessary new keyword at lib/a.dart:2:11 • unnecessary_new
  lint • Unnecessary new keyword at lib/a.g.dart:2:11 • unnecessary_new
2 lints found.

Regarding the exclude section lint on a.g.dart shouldn't be there.

As the generated file is not really modifiable this issue is quite annoying when you use package like source_gen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onlegacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions