Skip to content

Introduce a Project description property and support for it in node #9511

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 4 commits into from
Nov 28, 2024

Conversation

fviernau
Copy link
Member

Add the description property to project's, analog to the one in packages and implement support in all node package managers.

Fixes #9443.

@fviernau fviernau requested a review from a team as a code owner November 27, 2024 08:49
@fviernau fviernau enabled auto-merge (rebase) November 27, 2024 08:49
@fviernau fviernau changed the title Introduce Project description property and support for it in node Introduce a Project description property and support for it in node Nov 27, 2024
@fviernau fviernau changed the title Introduce a Project description property and support for it in node Introduce a Project description property and support for it in node Nov 27, 2024
@fviernau fviernau added analyzer About the analyzer tool enhancement labels Nov 27, 2024
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.97%. Comparing base (c5bae26) to head (c983dc3).
Report is 9 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9511      +/-   ##
============================================
+ Coverage     67.96%   67.97%   +0.01%     
  Complexity     1290     1290              
============================================
  Files           249      249              
  Lines          8810     8813       +3     
  Branches        915      916       +1     
============================================
+ Hits           5988     5991       +3     
  Misses         2433     2433              
  Partials        389      389              
Flag Coverage Δ
funTest-docker 64.84% <100.00%> (+0.01%) ⬆️
funTest-non-docker 33.24% <ø> (-0.02%) ⬇️
test 35.84% <0.00%> (+0.01%) ⬆️

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.

/**
* The description of project.
*/
val description: String = "",
Copy link
Member

Choose a reason for hiding this comment

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

I tend to not assign a default value here (and instead assign the empty string in Project.EMPTY), even if that requires more code changes.

But I'm anyway in the context of #9417 preparing a helper function to create projects (with always the correct projectType). Maybe we can postpone this PR until then, so that this change only needs to be done in a single place?

Copy link
Member

Choose a reason for hiding this comment

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

But we could also do it the opposite way, merge this first and fixup the default argument later.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not using a default value primary consideration IMO should be whether we need backwards compatible deserialization. As you didn't mention this explicitly, I want to double check whether your intention is to break this compatability and if so why?

Copy link
Member Author

Choose a reason for hiding this comment

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

But we could also do it the opposite way, merge this first and fixup the default argument later.

I prefer to merge this one first, as that other mentioned change also depends on my node refactoring.

Copy link
Member

Choose a reason for hiding this comment

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

whether we need backwards compatible deserialization.

Yes, we should have that. I overlooked your sentence in the commit message. So let's keep the empty default value.

Copy link
Member

Choose a reason for hiding this comment

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

that other mentioned change also depends on my node refactoring.

I don't think it does (strictly), as it's a rather small change. But I'm anyway fine with merging this PR first.

@@ -15,7 +15,7 @@ project:
type: "Git"
url: "<REPLACE_URL_PROCESSED>"
revision: "<REPLACE_REVISION>"
path: "plugins/package-managers/node/src/funTest/assets/projects/synthetic/npm/babel"
path: "<REPLACE_PATH>"
Copy link
Member

Choose a reason for hiding this comment

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

Commit message: Please explain why. As the test seems to have worked before, what's the improvement now?

Copy link
Member Author

@fviernau fviernau Nov 27, 2024

Choose a reason for hiding this comment

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

IIUC all <REPLACE_PATH> pattern are not necessary to make the tests work. But I can explain why regardlessly.

Copy link
Member

Choose a reason for hiding this comment

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

I'm still not convinced. <REPLACE_...> patterns in general should only be used for stuff that cannot be hard-coded in expected results, that's why the replace mechanism was introduced.

So if we're using <REPLACE_PATH> (or any other <REPLACE_...> pattern) where hard-coding would be possible in the expected result, we should hard-code instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

This would be a change in the approach, just consider the REPLACE_DEFINITION_FILE_PATH. That's probably not necessary in any case but we have it. This commit is only about making things (locally) consistent. I'm not against changing the approach per se, but not in this PR / commit.

BTW: The use of these patterns makes it easier to rename files, or to move them.

Copy link
Member

Choose a reason for hiding this comment

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

The use of these patterns makes it easier to rename files, or to move them.

So that is the argument that convinces me, and that I would have liked to read in the commit message. I'll approve.

@@ -85,6 +85,11 @@ data class Project(
*/
val vcsProcessed: VcsInfo = vcs.normalize(),

/**
* The description of project.
Copy link
Member Author

Choose a reason for hiding this comment

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

Do you guys believe empty values should be serialized or omit from serialization?
(Former requires updating all expected results)

Copy link
Member

Choose a reason for hiding this comment

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

I believe empty / default values should be omitted (for smaller file size).

@fviernau fviernau requested a review from sschuberth November 27, 2024 09:58
@fviernau fviernau force-pushed the feat-model-project-description branch from 4d4b53d to 341423a Compare November 27, 2024 13:14
Use a default value to ensure backwards compatible de-serialization.

Fixes #9443.

Signed-off-by: Frank Viernau <[email protected]>
@fviernau fviernau force-pushed the feat-model-project-description branch from 341423a to debd44c Compare November 27, 2024 14:21
Using the replace pattern for the path is not necessary to make the test
pass, analog to other tests, but improves consistency.

Signed-off-by: Frank Viernau <[email protected]>
@fviernau fviernau force-pushed the feat-model-project-description branch from debd44c to c983dc3 Compare November 27, 2024 18:09
@fviernau fviernau merged commit 1232796 into main Nov 28, 2024
23 checks passed
@fviernau fviernau deleted the feat-model-project-description branch November 28, 2024 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer About the analyzer tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Project data class should have a description property like the Package data class has
2 participants