-
Notifications
You must be signed in to change notification settings - Fork 26
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: Add scanning of local files and folders (single scan) #558
Conversation
Signed-off-by: Oleg Kopysov <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #558 +/- ##
============================================
+ Coverage 92.64% 93.08% +0.44%
- Complexity 530 545 +15
============================================
Files 48 48
Lines 1753 1822 +69
Branches 208 221 +13
============================================
+ Hits 1624 1696 +72
+ Misses 64 59 -5
- Partials 65 67 +2 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Oleg Kopysov <[email protected]>
16b8214
to
01e536f
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
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.
Approved
@tiokim Please take a look at this PR. I would be grateful for your review and feedback. |
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!
// Check for any pending elements in the LPVSQueue. | ||
queueService.checkForQueue(); | ||
|
||
// Process LPVSQueue elements until the trigger is set. | ||
while (trigger == null || trigger.isEmpty()) { | ||
while ((trigger == null || trigger.isEmpty()) |
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 using isBlank
instead of isEmpty
?
List<LPVSLicenseService.Conflict<String, String>> detectedConflicts = null; | ||
|
||
// Error case when both pull request scan and local files scan are set to true | ||
if (trigger != null && !trigger.isEmpty() && localPath != null && !localPath.isEmpty()) { |
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 using isBlank
instead of isEmpty
?
Signed-off-by: Oleg Kopysov <[email protected]>
3221d85
Signed-off-by: Oleg Kopysov <[email protected]>
Signed-off-by: Oleg Kopysov <[email protected]>
Signed-off-by: Oleg Kopysov <[email protected]>
3221d85
to
bf6065e
Compare
log.info("Single scan of pull request completed."); | ||
} catch (Exception ex) { | ||
log.error("Single scan of pull request finished with errors."); | ||
log.error("Can't trigger single scan: " + ex.getMessage()); |
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.
"Single scan finished" and at the same time "Can't trigger single scan"
What about use something general: ""
log.error("Single scan of pull request failed with error: " + ex.getMessage());
} catch (Exception ex) { | ||
log.error("Single scan finished with errors."); | ||
log.error("Single scan of local file(s) finished with errors."); | ||
log.error("Can't trigger single scan: " + ex.getMessage()); |
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:
log.error("Single scan of local file(s) failed with error: " + ex.getMessage());
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 are 2 small suggestions about error logs, but in general LGTM
// Check for any pending elements in the LPVSQueue. | ||
queueService.checkForQueue(); | ||
|
||
// Process LPVSQueue elements until the trigger is set. | ||
while (trigger == null || trigger.isEmpty()) { | ||
while ((trigger == null || trigger.isBlank()) | ||
&& (localPath == null || localPath.isBlank())) { |
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.
localPath.isBlank()
includes a case with null
, right?
If so, there is no reason to check it for localPath
and trigger
:
while (trigger.isBlank())
&& (localPath.isBlank())
...
List<LPVSLicenseService.Conflict<String, String>> detectedConflicts = null; | ||
|
||
// Error case when both pull request scan and local files scan are set to true | ||
if (trigger != null && !trigger.isBlank() && localPath != null && !localPath.isBlank()) { |
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.
As isBlank include check for a null
, so it could be simplified to:
if (!trigger.isBlank() && !localPath.isBlank())
Signed-off-by: Oleg Kopysov <[email protected]>
…to local-files-scan
Signed-off-by: Oleg Kopysov <[email protected]>
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.
Good improvement! Thank you!
Pull Request
Description
Current PR contains:
Type of change
Please delete options that are not relevant.
Testing
Unit tests and local functional tests.
Checklist: