VeryGoodOpenSource/very_good_analysis

Disable analysis for generated files

Closed this issue · 1 comments

Some code generation tools may not follow the very good analysis recommendations ,
but one would still prefer them for other parts of the code rather than disabling them .

Exclude files ending with .g.dart from analysis

analyzer:
  language:
    strict-casts: true
    strict-inference: true
    strict-raw-types: true

  errors:
    close_sinks: ignore
    missing_required_param: error
    missing_return: error
    record_literal_one_positional_no_trailing_comma: error

  exclude:
    - test/.test_coverage.dart
    - lib/generated_plugin_registrant.dart
    - lib/**.g.dart

It is better to leave file path configurations out of the package yaml so they are focused on the lint rules.

Defining which files should or should not be affected by the analyzer is a configuration that should be done by project.

You already can add this configuration in your local analysis_options.yaml file:

include: package:very_good_analysis/analysis_options.5.0.0.yaml

analyzer:
  exclude:
    - test/.test_coverage.dart
    - lib/generated_plugin_registrant.dart
    - lib/**.g.dart