Skip to content

Changes to qualified scopes for dependency graphs #9844

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

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

sschuberth
Copy link
Member

@sschuberth sschuberth commented Jan 27, 2025

Please have a look at the individual commit messages for the details.

@sschuberth sschuberth requested a review from a team as a code owner January 27, 2025 16:09
@sschuberth sschuberth enabled auto-merge (rebase) January 27, 2025 16:09
Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.12%. Comparing base (253dfba) to head (fdaa917).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #9844   +/-   ##
=========================================
  Coverage     68.12%   68.12%           
+ Complexity     1293     1292    -1     
=========================================
  Files           250      250           
  Lines          8843     8840    -3     
  Branches        918      917    -1     
=========================================
- Hits           6024     6022    -2     
+ Misses         2432     2431    -1     
  Partials        387      387           
Flag Coverage Δ
funTest-docker 65.14% <ø> (ø)
funTest-non-docker 33.37% <0.00%> (+0.01%) ⬆️
test-ubuntu-24.04 35.76% <100.00%> (-0.02%) ⬇️
test-windows-2022 35.73% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sschuberth sschuberth disabled auto-merge January 27, 2025 17:51
@sschuberth sschuberth changed the title chore(model)!: Remove the possibility to return qualified scope names Changes to qualified scopes for dependency graphs Jan 27, 2025
@sschuberth sschuberth force-pushed the dependency-graph-simplifications branch 2 times, most recently from 8b5f983 to 8b4002e Compare January 27, 2025 19:19
@sschuberth sschuberth enabled auto-merge (rebase) January 27, 2025 19:19
@@ -157,28 +157,24 @@ data class DependencyGraph(
* Transform the data stored in this object to the classical layout of dependency information, which is a set of
* [Scope]s referencing the packages they depend on.
*/
fun createScopes(): Set<Scope> = createScopesFor(scopes, unqualify = true)
fun createScopes(): Set<Scope> = createScopesFor(scopes)
Copy link
Member

Choose a reason for hiding this comment

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

commit-msg: how scope -> how scopes

@@ -95,11 +95,11 @@ class AnalyzerResultBuilderTest : WordSpec() {
private val depRef3 = DependencyReference(0, issues = listOf(issue5))

private val scopeMapping1 = mapOf(
DependencyGraph.qualifyScope(project1, "scope-1") to listOf(RootDependencyIndex(0)),
DependencyGraph.qualifyScope(project3, "scope-2") to listOf(RootDependencyIndex(1))
DependencyGraph.qualifyScope(project1.id, "scope-1") to listOf(RootDependencyIndex(0)),
Copy link
Member

Choose a reason for hiding this comment

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

Hm, the previous code was a bit less repetitive.

I also do not understand why the symmetry becomes clearer and why this is favorable / what value that brings.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, the previous code was a bit less repetitive.

Do you mean "verbose" instead of "repetitive"? Because the refactoring does not introduce any code repetition, as I see it.

What I like about only taking the ID in qualifyScope() is that it makes more clear which properties of a Project play a role in qualification, i.e. only the Identifier. Also that overload doe snot really save much typing, as adding .id is trivial.

I also do not understand why the symmetry becomes clearer and why this is favorable / what value that brings.

I was planning to change unqualifyScope() to also return the encoded project ID, of which you can reconstruct an Identifier, but not a whole Project. That's why I believe qualifyScope() should not take a Project if unqualifyScope() cannot reconstruct it.

All callers set `unqualify` to `true` (except for one usage in a test),
so hard-code that to simplify code. Qualified scope names should be an
implementation detail for how scopes are disambiguated across projects.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
Inline the function in favor of only keeping the function that takes a
project's ID. This makes the symmetry to `unqualifyScope()` clearer.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
@sschuberth sschuberth force-pushed the dependency-graph-simplifications branch from 8b4002e to fdaa917 Compare January 28, 2025 14:19
@sschuberth sschuberth requested review from fviernau and a team January 28, 2025 14:19
@sschuberth sschuberth merged commit 71d4614 into main Jan 28, 2025
26 checks passed
@sschuberth sschuberth deleted the dependency-graph-simplifications branch January 28, 2025 21:07
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.

2 participants