Skip to content
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 API for single pull request scan #370

Merged
merged 15 commits into from
Jan 5, 2024
Merged

Conversation

o-kopysov
Copy link
Collaborator

@o-kopysov o-kopysov commented Dec 27, 2023

Pull Request

Description

Current PR includes a new REST API for a single pull request scan.
Also, it contains code refactoring and UT updates.

Fixes #354

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code cleanup/refactoring
  • Documentation update
  • This change requires a documentation update
  • CI system update
  • Test Coverage update

Testing

http://localhost:7896/scan/github.com/samsung/lpvs/370

image

Checklist:

  • My code follows the style guidelines of this project
  • My code meets the required code coverage for lines (90% and above)
  • My code meets the required code coverage for branches (80% and above)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@o-kopysov o-kopysov added this to the v1.4.0 milestone Dec 27, 2023
@o-kopysov o-kopysov self-assigned this Dec 27, 2023
@codecov-commenter
Copy link

codecov-commenter commented Dec 27, 2023

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (f7ac60c) 90.94% compared to head (a660f71) 90.90%.

Files Patch % Lines
src/main/java/com/lpvs/util/LPVSWebhookUtil.java 40.00% 4 Missing and 5 partials ⚠️
...ain/java/com/lpvs/controller/GitHubController.java 84.37% 4 Missing and 1 partial ⚠️
.../main/java/com/lpvs/service/LPVSGitHubService.java 93.75% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #370      +/-   ##
============================================
- Coverage     90.94%   90.90%   -0.04%     
+ Complexity      487      486       -1     
============================================
  Files            47       47              
  Lines          1700     1737      +37     
  Branches        206      209       +3     
============================================
+ Hits           1546     1579      +33     
+ Misses           97       94       -3     
- Partials         57       64       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@o-kopysov
Copy link
Collaborator Author

[License Pre-Validation Service] No license issue detected

Detected licenses:

File: src/test/java/com/lpvs/controller/GitHubControllerTest.java
License(s): MIT (permitted)
Component: LPVS (test/java/com/lpvs/controller/GitHubWebhooksControllerTest.java)
Matched Lines: 9-83
Snippet Match: 47%

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
@o-kopysov
Copy link
Collaborator Author

o-kopysov commented Dec 28, 2023

JaCoCo Test Coverage Summary

  • Coverage: 92.920%
  • Branches: 80.442%

@o-kopysov o-kopysov changed the title [WIP] feat: Add API for single pull request scan feat: Add API for single pull request scan Dec 28, 2023
@o-kopysov o-kopysov marked this pull request as ready for review December 28, 2023 13:25
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
doc/lpvs-api.yaml Outdated Show resolved Hide resolved
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
@o-kopysov o-kopysov force-pushed the api-354 branch 3 times, most recently from 863dd83 to 6b7b0d0 Compare January 2, 2024 12:53
@o-kopysov o-kopysov requested a review from tiokim January 2, 2024 12:59
Copy link
Collaborator

@m-rudyk m-rudyk left a comment

Choose a reason for hiding this comment

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

Approved.

Copy link
Member

@tiokim tiokim left a comment

Choose a reason for hiding this comment

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

LGTM
Is it possible to add the job for running the single scan along with Samsung/LPVS/{PR number} to the webhook file for ease of verification?

@o-kopysov
Copy link
Collaborator Author

LGTM Is it possible to add the job for running the single scan along with Samsung/LPVS/{PR number} to the webhook file for ease of verification?

We already have a plan to implement GitHub action for LPVS: #319
Or did you mean something else?

@tiokim
Copy link
Member

tiokim commented Jan 3, 2024

LGTM Is it possible to add the job for running the single scan along with Samsung/LPVS/{PR number} to the webhook file for ease of verification?

We already have a plan to implement GitHub action for LPVS: #319 Or did you mean something else?

I want to see if the function works well through the workflow for every PR.

@o-kopysov
Copy link
Collaborator Author

I want to see if the function works well through the workflow for every PR.

Current single scan API is implemented for "server mode" of LPVS operation. To check its functionality, we need to run LPVS server somewhere.

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
@o-kopysov
Copy link
Collaborator Author

[License Pre-Validation Service] No license issue detected

Detected licenses:

File: src/main/java/com/lpvs/service/LPVSQueueService.java
License(s): MIT (permitted)
Component: LPVS (main/java/com/lpvs/service/LPVSQueueService.java)
Matched Lines: 193-218
Snippet Match: 11%

File: src/test/java/com/lpvs/entity/enums/LPVSPullRequestActionTest.java
License(s): MIT (permitted)
Component: LPVS (test/java/com/lpvs/entity/enums/LPVSPullRequestActionTest.java)
Matched Lines: 2-51
Snippet Match: 96%

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
@o-kopysov
Copy link
Collaborator Author

[License Pre-Validation Service] No license issue detected

Detected licenses:

File: src/main/java/com/lpvs/service/LPVSQueueService.java License(s): MIT (permitted) Component: LPVS (main/java/com/lpvs/service/LPVSQueueService.java) Matched Lines: 193-218 Snippet Match: 11%

File: src/test/java/com/lpvs/entity/enums/LPVSPullRequestActionTest.java License(s): MIT (permitted) Component: LPVS (test/java/com/lpvs/entity/enums/LPVSPullRequestActionTest.java) Matched Lines: 2-51 Snippet Match: 96%

Here is a result of single scan execution

@tiokim
Copy link
Member

tiokim commented Jan 4, 2024

[License Pre-Validation Service] No license issue detected
Detected licenses:
File: src/main/java/com/lpvs/service/LPVSQueueService.java License(s): MIT (permitted) Component: LPVS (main/java/com/lpvs/service/LPVSQueueService.java) Matched Lines: 193-218 Snippet Match: 11%
File: src/test/java/com/lpvs/entity/enums/LPVSPullRequestActionTest.java License(s): MIT (permitted) Component: LPVS (test/java/com/lpvs/entity/enums/LPVSPullRequestActionTest.java) Matched Lines: 2-51 Snippet Match: 96%

Here is a result of single scan execution

Thanks for the hard work. It seems good to merge now!

@o-kopysov o-kopysov merged commit 28ef2d3 into Samsung:main Jan 5, 2024
7 checks passed
@o-kopysov o-kopysov deleted the api-354 branch January 5, 2024 02:37
rnd4you pushed a commit to rnd4you/LPVS that referenced this pull request Jan 5, 2024
* feat: Add API for single pull request scan

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* docs: Add new endpoint description in YAML file

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Cover new endpoint by unit tests

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Update unit tests for LPVSPullRequestAction

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update endpoint based on the code review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* feat: Add API for single pull request scan

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* docs: Add new endpoint description in YAML file

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Cover new endpoint by unit tests

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Update unit tests for LPVSPullRequestAction

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update endpoint based on the code review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Fix build after incorrect rebase

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update code based on the review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

---------

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
rnd4you pushed a commit to rnd4you/LPVS that referenced this pull request Jan 5, 2024
* feat: Add API for single pull request scan

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* docs: Add new endpoint description in YAML file

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Cover new endpoint by unit tests

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Update unit tests for LPVSPullRequestAction

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update endpoint based on the code review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* feat: Add API for single pull request scan

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* docs: Add new endpoint description in YAML file

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Cover new endpoint by unit tests

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Update unit tests for LPVSPullRequestAction

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update endpoint based on the code review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Fix build after incorrect rebase

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update code based on the review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

---------

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
rnd4you pushed a commit to rnd4you/LPVS that referenced this pull request Jan 5, 2024
* feat: Add API for single pull request scan

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* docs: Add new endpoint description in YAML file

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Cover new endpoint by unit tests

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Update unit tests for LPVSPullRequestAction

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update endpoint based on the code review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* feat: Add API for single pull request scan

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* docs: Add new endpoint description in YAML file

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Cover new endpoint by unit tests

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Update unit tests for LPVSPullRequestAction

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update endpoint based on the code review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Fix build after incorrect rebase

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update code based on the review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

---------

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
rnd4you pushed a commit to rnd4you/LPVS that referenced this pull request Jan 5, 2024
* feat: Add API for single pull request scan

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* docs: Add new endpoint description in YAML file

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Cover new endpoint by unit tests

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Update unit tests for LPVSPullRequestAction

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update endpoint based on the code review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* feat: Add API for single pull request scan

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* docs: Add new endpoint description in YAML file

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Cover new endpoint by unit tests

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* test: Update unit tests for LPVSPullRequestAction

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update endpoint based on the code review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Fix build after incorrect rebase

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

* fix: Update code based on the review comments

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>

---------

Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REST Interface to run a single scan job
6 participants