-
Notifications
You must be signed in to change notification settings - Fork 55
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
chore: update package information report #2674
Conversation
"Downstream Unmanaged Dependency Check / validate (java-bigtable)" is irrelevant to this PR. |
return builder.toString(); | ||
} | ||
|
||
private void appendToReport(StringBuilder builder, PackageInfo packageInfo) { |
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.
static?
} | ||
|
||
private String endSeparator() { | ||
return "==========================================================="; | ||
} | ||
|
||
private String packageInfoReport() { |
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.
Would you add a test case of the pull request description?
Java 17's test block should make it easy. https://blogs.oracle.com/javamagazine/post/text-blocks-come-to-java
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.
Would you add a test case of the pull request description?
It's not easily test using unit test as the encoded string needs to be sent to deps.dev to verify the correctness.
I'll write an integration test for it.
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.
Would you write this in a way that the formatter function should operate on a Record class to generate the formatted string.
In this design, the unit test for the formatter does not need to access deps.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.
Wrote unit tests to verify the encoded string.
builder.append(String.format("## Package information of %s\n", versionKey)); | ||
builder.append(String.format("Licenses: %s\n", packageInfo.licenses())); | ||
builder.append( | ||
String.format("Vulnerabilities: None.\nChecked in [deps.dev query](%s)\n", |
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.
The visible part of the link should have the artifact coordinates.
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.
Done.
builder.append("\n\n"); | ||
appendToReport(builder, packageInfos.get(0)); | ||
|
||
builder.append("## Dependencies:\n"); |
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.
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.
Done.
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.
Approving this, as it's good enhancement already. We may add more pull requests later to follow up.
} | ||
|
||
private String endSeparator() { | ||
return "==========================================================="; | ||
} | ||
|
||
private String packageInfoReport() { |
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.
Would you write this in a way that the formatter function should operate on a Record class to generate the formatted string.
In this design, the unit test for the formatter does not need to access deps.dev.
Quality Gate passed for 'gapic-generator-java-root'Issues Measures |
Quality Gate passed for 'java_showcase_integration_tests'Issues Measures |
In this PR: - Generate package information report for package that has no non-compliant licenses and security vulnerabilities. - Encode version using `URLEncoder`. The version may contain special characters that needs to be encoded before sending to deps.dev, e.g., [9+181-r4173-1](https://deps.dev/maven/com.google.errorprone%3Ajavac-shaded/9%2B181-r4173-1). An example of the report: ``` ## Package information of io.opentelemetry:opentelemetry-api:1.37.0 Licenses: [Apache-2.0] Vulnerabilities: None. Checked in [deps.dev query](https://api.deps.dev/v3/query?versionKey.system=MAVEN&versionKey.name=io.opentelemetry:opentelemetry-api&versionKey.version=1.37.0) ## Dependencies: ## Package information of io.opentelemetry:opentelemetry-context:1.37.0 Licenses: [Apache-2.0] Vulnerabilities: None. Checked in [deps.dev query](https://api.deps.dev/v3/query?versionKey.system=MAVEN&versionKey.name=io.opentelemetry:opentelemetry-context&versionKey.version=1.37.0) ```
In this PR:
URLEncoder
. The version may contain special characters that needs to be encoded before sending to deps.dev, e.g., 9+181-r4173-1.An example of the report: