Repository navigation
[flutter_tools] Resolve includes recursively in AnalysisOptionsMigration - #191082
Merged
Merged
Conversation
AnalysisOptionsMigration was ignoring include: directives, causing it to repeatedly rewrite analysis_options.yaml files that already inherited the required exclusions. This change updates the migrator to recursively collect excludes from includes, supporting relative paths and package: URIs, multiple includes, and cycle detection. Fixes flutter#191056
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates AnalysisOptionsMigration to recursively collect analyzer exclude patterns from analysis_options.yaml and any referenced configuration files via include directives, supporting both relative paths and package: URIs while preventing infinite recursion on cyclic includes. Feedback suggests using path.canonicalize to robustly handle case-insensitivity during cycle detection on Windows and macOS, and wrapping synchronous file reads in a try-catch block to gracefully handle potential FileSystemExceptions.
…AnalysisOptionsMigration
chingjun
approved these changes
Aug 13, 2026
This was referenced Aug 14, 2026
This was referenced Aug 15, 2026
2 of 5 tasks
Closed
2 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
AnalysisOptionsMigrationwas ignoringinclude:directives inanalysis_options.yamlfiles, causing it to repeatedly rewrite files that already inherited the required platform and build directory exclusions (such asbuild/**,android/**, etc.) from included files (either relative paths orpackage:URIs).This PR updates
AnalysisOptionsMigrationto:exclude:patterns frominclude:directives.package:URIs for includes (usingPackageConfig).includeis specified as a YAML list).PackageConfigfromensureReadyForPlatformSpecificToolingtoAnalysisOptionsMigration.Related Issues
Fixes #191056
Tests
analysis_options_migration_test.dart:skipped if exclusions are inherited via relative includeskipped if exclusions are inherited via package includeskipped if exclusions are inherited via multiple includeshandles cyclic includes without crashinghandles invalid exclude types without crashing