-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: Generate html report for single scan mode #358
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #358 +/- ##
============================================
- Coverage 91.34% 91.01% -0.33%
- Complexity 475 486 +11
============================================
Files 48 48
Lines 1606 1703 +97
Branches 194 206 +12
============================================
+ Hits 1467 1550 +83
- Misses 82 89 +7
- Partials 57 64 +7 ☔ View full report in Codecov by Sentry. |
cd6698e
to
2103c2a
Compare
Signed-off-by: Mykola Rudyk <m.rudyk@samsung.com>
Signed-off-by: Mykola Rudyk <m.rudyk@samsung.com>
Signed-off-by: Mykola Rudyk <m.rudyk@samsung.com>
2103c2a
to
9014e0d
Compare
README.md
Outdated
@@ -271,7 +271,7 @@ Alternatively, you can perform a one-time scan on a specific pull request using | |||
4.b.2. Execute the single scan with the following command: | |||
|
|||
```bash | |||
java -jar -Dgithub.token=<my-token> lpvs-*.jar --github.pull.request=<PR URL> | |||
java -jar -Dgithub.token=<my-token> lpvs-*.jar --github.pull.request=<PR URL> --build.html.report=<Path to report folder> |
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.
Do we need to specify Path to report folder or Path + Filename?
It's not clear from the description. Pease add more words into Readme.
log.info(jsonTxt); | ||
log.info("\n\n\n Single scan finished successfully \n\n\n"); | ||
|
||
scanossDetectService.runScan( |
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 can't entirely agree with this line.
The previous logic was to use this.runScan()
for the case when several scanners can be used. Current change has hardcoded scanossDetectService.runScan()
option which blocks the flexibility of the implementation.
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
String report = | ||
LPVSCommentUtil.buildHTMLComment( | ||
webhookConfig, scanResult, detectedConflicts); | ||
LPVSCommentUtil.saveHTMLToFile(report, buildReport + "/LPVSreport.html"); |
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.
Maybe it's better to define filename via CLI parameter?
String report = | ||
LPVSCommentUtil.reportCommentBuilder( | ||
webhookConfig, scanResult, detectedConflicts); | ||
log.info(report); | ||
} | ||
} catch (Exception ex) { | ||
log.info("\n\n\n Single scan finished with errors \n\n\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.
Maybe log.error
is a better choise?
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.
next message is error with reporting. But we may change this as well.
|
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.
Please check my comments
4bf5647
to
217f3ef
Compare
Signed-off-by: Mykola Rudyk <m.rudyk@samsung.com>
45c36f7
to
478a7d8
Compare
|
8bc02c0
to
a889502
Compare
Signed-off-by: Mykola Rudyk <m.rudyk@samsung.com>
449bf24
to
7965aca
Compare
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.
PTAL
// ToDo: form html report and console output | ||
log.info(jsonTxt); | ||
log.info("\n\n\n Single scan finished successfully \n\n\n"); | ||
List<LPVSFile> scanResult = scanossDetectService.checkLicenses(webhookConfig); |
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 think the code can be revised like below.
List<LPVSFile> scanResult = this.runScan(webhookConfig, LPVSDetectService.getPathByPullRequest(webhookConfig));
@Autowired private ApplicationEventPublisher eventPublisher; | ||
|
||
@Value("${github.pull.request:}") | ||
private String trigger; | ||
|
||
@Value("${build.html.report:}") | ||
private String buildReport; |
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 about changing the name to htmlReport
?
List<LPVSLicenseService.Conflict<String, String>> detectedConflicts = | ||
licenseService.findConflicts(webhookConfig, scanResult); | ||
|
||
if (buildReport != null && !HtmlUtils.htmlEscape(buildReport).equals("")) { |
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.
Why do we need to run HtmlUtils.htmlEscape(buildReport)
?
@@ -66,4 +74,122 @@ public static String getMatchedLinesAsLink( | |||
log.debug("MatchedLines: " + matchedLines); | |||
return matchedLines; | |||
} | |||
|
|||
public static String reportCommentBuilder( |
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.
Please add Javadoc comments for all new functions.
Signed-off-by: Mykola Rudyk <m.rudyk@samsung.com>
aee75c7
to
18f0fd9
Compare
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.
LGTM
@m-rudyk Please resolve merge conflicts. |
d1279ea
to
6b261c7
Compare
Signed-off-by: m-rudyk <121865672+m-rudyk@users.noreply.github.com>
6b261c7
to
22dce35
Compare
Pull Request
Description
added option for signle scan operation to generate html report with conflict files.
Fixes #359
Type of change
Please delete options that are not relevant.
Testing
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.
Test Configuration:
Checklist: