-
Couldn't load subscription status.
- Fork 356
feat(helper-cli): Add a command to re-serialize the test assets #7068
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
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #7068 +/- ##
============================================
- Coverage 64.61% 64.21% -0.41%
Complexity 1969 1969
============================================
Files 331 333 +2
Lines 16654 16759 +105
Branches 2387 2394 +7
============================================
Hits 10761 10761
- Misses 4846 4951 +105
Partials 1047 1047
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
f32ce7a to
ca3177f
Compare
helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt
Outdated
Show resolved
Hide resolved
helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt
Outdated
Show resolved
Hide resolved
helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt
Outdated
Show resolved
Hide resolved
helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt
Outdated
Show resolved
Hide resolved
ca3177f to
260b795
Compare
helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt
Outdated
Show resolved
Hide resolved
helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt
Outdated
Show resolved
Hide resolved
helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt
Outdated
Show resolved
Hide resolved
helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt
Outdated
Show resolved
Hide resolved
260b795 to
dfb7278
Compare
helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt
Outdated
Show resolved
Hide resolved
helper-cli/src/main/kotlin/commands/dev/RewriteTestAssetsCommand.kt
Outdated
Show resolved
Hide resolved
dfb7278 to
eaca3de
Compare
This can be helpful for development. Signed-off-by: Frank Viernau <[email protected]>
Signed-off-by: Frank Viernau <[email protected]>
c3f3f19 to
8d55dda
Compare
| // Paths to nodes in the tree of JsonNodes, whose subtree shall not be changed. Explicitly ignoring these subtrees is | ||
| // needed in order to avoid bringing in default values property values which are not present in the original file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've being thinking about the rationale once more. What confused me so far is the emphasis of (arbitrary) "default values". But actually, what I believe you mean is the machine-specific values of the config and environment classes that are used by default. When rewriting files, you do not want to update e.g. the amount of available memory with the number from the machine running the rewrite command, but you simply want to keep what's in the file, correct?
If so, I propose the following wording:
Some serialized classes contain information specific to the machine the serialization was run on. When reserializing files, nodes containing such information should not be updated but taken as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what I believe you mean is the machine-specific values of the config and environment classes
Yet more detailed, if machine-specific values would be used, the replacing back of dummy values to placeholders would not work, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When rewriting files, you do not want to update e.g. the amount of available memory with the number from the machine running the rewrite command, but you simply want to keep what's in the file, correct?
Yes, I simply want to keep the subtree as-is. I'm not sure what you exactly refer to with "machine-specific", but in my view referring to "default values" in general perfectly fits here. This for example also refers to
ort/model/src/main/kotlin/config/OrtConfiguration.kt
Lines 63 to 80 in 8998d83
| val enableRepositoryPackageConfigurations: Boolean = false, | |
| /** | |
| * Enable the usage of project-local package curations from the [RepositoryConfiguration]. If set to true, apply | |
| * package curations from a local .ort.yml file before applying those specified via the command line i.e. curations | |
| * from the .ort.yml take precedence. | |
| */ | |
| val enableRepositoryPackageCurations: Boolean = false, | |
| /** | |
| * Force overwriting of any existing output files. | |
| */ | |
| val forceOverwrite: Boolean = false, | |
| /** | |
| * The license file patterns. | |
| */ | |
| val licenseFilePatterns: LicenseFilePatterns = LicenseFilePatterns.DEFAULT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet more detailed, if machine-specific values would be used, the replacing back of dummy values to placeholders would not work, right?
I don't understand this question. Can you elaborate a bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking was that you first replace e.g.
`"\"<REPLACE_MAX_MEMORY>\""` with `"33445504"`
and later again replace
`"33445504"` with `"\"<REPLACE_MAX_MEMORY>\""`
and in between those two replacements "33445504" would get replaced with the real amount of memory of the machine running the command, the back-replacing would not work anymore. But giving it a second thought, I believe this cannot happen, exactly because these values are being patched, i.e. they are present in the file, and thus no default value is used for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you exactly refer to with "machine-specific"
I'm referring to default values, esp. in Environment, that vary from machine to machine, like the maxMemory property. I had a feeling that the real reason for the code is that you only want to not take those properties. But if you really also do not want to take properties like enableRepositoryPackageConfigurations, then the term "machine-specific" obviously is not applicable.
| * License-Filename: LICENSE | ||
| */ | ||
|
|
||
| package org.ossreviewtoolkit.helper.commands.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Maybe spell out the package (and directory) name as "development" as other similar grouping commands don't use abbreviations either. For the command itself, I acknowledge "orth dev ..." is nice to be short.
This can be helpful for development.