Open cabaucom376 opened 3 weeks ago
I experience similar behavior in my project. In this monorepo, there is a package www_analysis
dedicated to configuring analyzer, which only contains lib/analysis_options.yaml
file with the following content:
analyzer:
exclude:
- lib/**.g.dart
- lib/**.freezed.dart
- lib/**.i69n.dart
- lib/**.config.dart
errors:
missing_required_param: error
missing_return: error
invalid_assignment: warning
invalid_annotation_target: ignore
This package is referenced by path
by every other package, and their analysis_options.yaml
file contains:
include: package:www_analysis/analysis_options.yaml
With this configuration, the project used to have no analyzer warnings in generated files, and also did not have invalid_annotation_target
warnings because it was instructed to ignore those.
However, after I switched from stable channel Flutter 3.22.2
and Dart 3.4.3
to beta Flutter 3.23.0-0.1.pre
and Dart 3.5.0-180.3.beta
, this configuration provided with include
seems to be ignored as there are now invalid_annotation_target
warnings everywhere.
If I copy the content of www_analysis/lib/analysis_options.yaml
file to analysis_options.yaml
of other packages, warnings in those packages disappear.
There is another possible reason for the behavior being reported here: it's possible that the interpretation of relative paths changed. If the relative path is now interpreted relative to the analysis_options.yaml
file in www_analysis
and was previously interpreted relative to the including analysis_options.yaml
file, that would account for the difference.
@pq
For the last 6 moths I have been using this guide to essentially include all linter rules and then override the conflicts and tune the rules to my taste. I have made this simple little setup into a package that I host on a private GitHub repo and just update the all_linter_rules.yaml file whenever new rules are added, as well as make sure all conflicts are resolved. With the 3.23 beta I am encountering a new error even though my overall methods have remained consistent.
I am now getting warnings about conflicting linter rules in my
all_linter_rules.yaml
file even though conflicts are properly overridden and theincluded_file_warning: ignore
analyzer error is properly set. The weird part is that when I reference my custom analysis packages'analysis_options.yaml
locally the errors are not present. Only when referencing theanalysis_options.yaml
using a package import, from git hosted or local path, do these warnings appear.nv_analysis package files
Project files
pubspec.yaml:
analysis_options.yaml:
Expected results
The expected results is that I should be able to
include: package:nv_analysis/analysis_options.yaml
and not receive conflicts from theall_lint_rules.yaml
file since they have been resolved using overrides and even supposedly silenced usingincluded_file_warning: ignore
.Actual results
My best guess of what is actually happening is for some reason the
included_file_warning: ignore
is not being applied to subsequent inclusions in yaml files. This is resulting in linter rules showing up as conflicts. Interestingly this is only reproducible when importing as a package.Code sample
Attempt to import this analysis package in your projects analysis_options.yaml:
Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor output
```console [✓] Flutter (Channel beta, 3.23.0-0.1.pre, on macOS 14.5 23F79 darwin-arm64, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.4) [✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [✓] Android Studio (version 2023.1) [✓] VS Code (version 1.90.0) [✓] Connected device (4 available) ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac. The device must be opted into Developer Mode to connect wirelessly. (code -27) [✓] Network resources ! Doctor found issues in 1 category. ```Originally posted by @cabaucom376 in https://github.com/flutter/flutter/issues/149981