Skip to content

fix: merge each extended project right before the file that extends it - #594

Open
aliassar wants to merge 1 commit into
F1bonacc1:mainfrom
aliassar:fix-extends-merge-order
Open

aliassar wants to merge 1 commit into
F1bonacc1:mainfrom
aliassar:fix-extends-merge-order

Conversation

@aliassar

Copy link
Copy Markdown
Contributor

With several -f files that use extends, Load inserted each extended project at the file's index in the -f list, but earlier extends had already added projects there, so a later file's base was merged before the earlier files (-f a -f b with a extending c and b extending d merged as c, d, a, b instead of c, a, d, b). It now inserts at len(opts.projects), so each base lands right before the file that extends it, nested bases still go before their parent, and the order only changes when an earlier -f file uses extends. TestLoad_MultipleFilesWithExtends checks the merge order and merged values for two extending files, a plain file first, the reversed order and a nested base; it fails on main and passes with the fix. go test -race ./src/... and golangci-lint pass.

Fixes #593

With several -f files that use `extends`, the extended project was
inserted at the file's index in the -f list. Each earlier `extends`
adds a project, so later bases landed too early and earlier files
overrode them: `-f a -f b` merged as c, d, a, b instead of c, a, d, b.

Insert at the number of projects loaded so far instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

With several -f files that use extends, a later file's base is merged too early

1 participant