Skip to content

[CP] Fix analysis_options.yaml "include:" for nested folders in workspace. #56464

Description

@keertip

Commit(s) to merge

https://dart-review.googlesource.com/c/sdk/+/376500

Target

stable

Prepared changelist for beta/stable

https://dart-review.googlesource.com/c/sdk/+/380205

Issue Description

When folders/package are nested in a workspace, and the analysis_options.yaml has an include: that depends on the other package, the include: does not get resolved. This fix allows for nested folders to be separate workspaces with packages. This fixes an issue that was introduced with the changes for monorepo support.

What is the fix

The analyzer maintains a map of all known workspaces and their roots, and this is built by traversing the directory structure. The fix ensures that all nested roots were added to the map before any lookup is done.

Why cherry-pick

Since the include: in the analysis options cannot be resolved, the analysis performed can report errors/warnings that should be reported, and vice versa. This leads to a poor UX and makes it difficult to code, as now the user cannot rely on the analysis results.

Risk

Low risk.

Issue link(s)

#56047

Extra Info

No response

Metadata

Metadata

Labels

cherry-pick-approvedLabel for approved cherrypick requestcherry-pick-mergedCherry-pick has been merged to the stable or beta branch.cherry-pick-reviewIssue that need cherry pick triage to approvelegacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions