Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor SourceFileGrouping to remove provider logic #13522

Merged
merged 4 commits into from
Mar 6, 2024
Merged

Conversation

anthony-c-martin
Copy link
Member

@anthony-c-martin anthony-c-martin commented Mar 4, 2024

I felt like the logic in the SourceFileGroupingBuilder was becoming overly complex, with the introduction of concerns about how to parse and interpret provider declarations. This refactor moves provider interpretation logic into DeclarationVisitor, and keeps the responsibility of the SourceFileGroupingBuilder focused on obtaining the full set of source files + files that need to be restored from the registry.

Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

github-actions bot commented Mar 4, 2024

Test this change out locally with the following install scripts (Action run 8165730326)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 8165730326
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 8165730326"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 8165730326
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 8165730326"

@StephenWeatherford
Copy link
Contributor

Please make sure #13495 gets merged first, in case there are conflicts.

Copy link
Contributor

github-actions bot commented Mar 4, 2024

Test Results

    66 files   -     33      66 suites   - 33   22m 49s ⏱️ - 23m 40s
10 677 tests  -     19  10 675 ✅  -     20  2 💤 +1  0 ❌ ±0 
25 244 runs   - 12 615  25 240 ✅  - 12 616  4 💤 +1  0 ❌ ±0 

Results for commit 137d365. ± Comparison against base commit 3a300e5.

♻️ This comment has been updated with latest results.

@anthony-c-martin
Copy link
Member Author

Please make sure #13495 gets merged first, in case there are conflicts.

Will do! And I'm sure there will be :(


if (!uriResult.IsSuccess(out var artifactUri))
var resolutionInfo = GetArtifactRestoreResult(file, restorable);
Copy link
Contributor

@asilverman asilverman Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible to evaluate GetArtifactRestoreResult(file, restorable); once above the if-clause and use its result rather than calling the function in two seaparate places.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why this is beneficial?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just my opinion, but I think there are 2 main benefits:

  1. As a reader it makes it clear that the artifact restore result doesn't depend on the restorable type, and that the restore result is terminal
  2. It reduces the chance that one will change but not the other in future refactorings

These may not be strong enough justification, can you share your thoughts on the drawbacks of my suggestion and the benefits of keeping it as is?

@asilverman
Copy link
Contributor

LGTM, ship it! 🚀

@asilverman asilverman self-requested a review March 5, 2024 20:54
@asilverman asilverman added the housekeeping Things that we do to make the codebase easier to maintain label Mar 5, 2024
@asilverman asilverman added this to the v0.27 milestone Mar 5, 2024
@asilverman
Copy link
Contributor

Hey @anthony-c-martin , can this wait for #13537?

@anthony-c-martin
Copy link
Member Author

Hey @anthony-c-martin , can this wait for #13537?

Sure, happy to wait

@asilverman asilverman assigned asilverman and unassigned asilverman Mar 5, 2024
@asilverman asilverman merged commit c49faac into main Mar 6, 2024
44 checks passed
@asilverman asilverman deleted the ant/sfg branch March 6, 2024 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Things that we do to make the codebase easier to maintain
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants