-
Notifications
You must be signed in to change notification settings - Fork 532
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
refactor: findTagSha method in ImageStreamService for improved readability #2547
refactor: findTagSha method in ImageStreamService for improved readability #2547
Conversation
Eclipse JKube CI ReportStarted new GH workflow run for #2547 (2024-01-17T19:00:17Z) ⚙️ JKube E2E Tests (7560394564)
|
|
||
// No image found, even after several retries: | ||
// Method to handle cases where no image is found | ||
private IllegalStateException handleNoImageFoundException(ImageStream currentImageStream, String imageStreamName) { |
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.
private IllegalStateException handleNoImageFoundException(ImageStream currentImageStream, String imageStreamName) { | |
private String handleNoImageFoundException(ImageStream currentImageStream, String imageStreamName) { |
Maybe instead of returning exception, you can get return exception message.
Thank you for the review, @rohanKanojia. I've updated the Also, I noticed SonarCloud's Quality Gate requirements suggests a test coverage of 80%. Is this a strict requirement for the project, or is the current level of coverage considered acceptable? Any guidance or insights on this matter would be greatly appreciated. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2547 +/- ##
=============================================
+ Coverage 59.36% 70.17% +10.81%
- Complexity 4586 4950 +364
=============================================
Files 500 478 -22
Lines 21211 19294 -1917
Branches 2830 2493 -337
=============================================
+ Hits 12591 13539 +948
+ Misses 7370 4526 -2844
+ Partials 1250 1229 -21 ☔ View full report in Codecov by Sentry. |
Improve readability and maintainability of findTagSha in ImageStreamService - Flattened nested loop structures for better readability. - Extracted complex logic into private helper methods. - Replaced continue statements with conditional logic. - Enhanced error handling for clearer exception messages. This refactor is in line with our goal to simplify complex methods and improve the overall code quality in the ImageStreamService class. Resolves eclipse-jkube#2531
- Updated findTagSha to handle String return from handleNoImageFoundException - Renamed handleNoImageFoundException to generateImageStreamErrorMessage for more accurate and descriptive name
18c329e
to
59caa93
Compare
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
Description
This PR addresses the task of refactoring the findTagSha method in the ImageStreamService class of the JKube Kit.
The original implementation used multiple continue statements and a goto statement.
This pull request introduces the following key changes which fulfill all the acceptance criteria:
I would appreciate a review to ensure that the changes align with the project's standards. Any feedback or suggestions for further improvement are welcome
Fixes #2531
Type of change
test, version modification, documentation, etc.)
Checklist