Skip to content

Fix new SonarQube code smells (S3024, S112, S1155) in service layer - #1102

Open
chetankh239 wants to merge 1 commit into
mosip:release-1.4.xfrom
chetankh239:fix/sonar-new-code-issues
Open

Fix new SonarQube code smells (S3024, S112, S1155) in service layer#1102
chetankh239 wants to merge 1 commit into
mosip:release-1.4.xfrom
chetankh239:fix/sonar-new-code-issues

Conversation

@chetankh239

@chetankh239 chetankh239 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Use StringBuilder.append chaining instead of string-concat append calls, narrow a generic Exception throw to the actual IOException, and use isEmpty() instead of size() comparisons.

Summary by CodeRabbit

  • Refactor
    • Improved internal code readability and maintainability.
    • Clarified error handling and simplified empty-list checks.
    • No user-visible behavior or generated content has changed.

Use StringBuilder.append chaining instead of string-concat append calls,
narrow a generic Exception throw to the actual IOException, and use
isEmpty() instead of size() comparisons.

Signed-off-by: Chetan Kumar Hirematha <chetankumar.h.239@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f0665c35-d924-4b0e-bf37-3c9005bafd38

📥 Commits

Reviewing files that changed from the base of the PR and between 3d77f0a and 77b4b8b.

📒 Files selected for processing (3)
  • mosip-compliance-toolkit/src/main/java/io/mosip/compliance/toolkit/service/BiometricTestDataService.java
  • mosip-compliance-toolkit/src/main/java/io/mosip/compliance/toolkit/service/ReportService.java
  • mosip-compliance-toolkit/src/main/java/io/mosip/compliance/toolkit/service/SbiProjectService.java

Walkthrough

The change updates three service methods. It replaces equivalent string concatenation and collection-size checks with standard APIs. It also narrows getPartnerDetails to declare IOException.

Changes

Service implementation cleanup

Layer / File(s) Summary
Service method cleanup
mosip-compliance-toolkit/src/main/java/io/mosip/compliance/toolkit/service/BiometricTestDataService.java, mosip-compliance-toolkit/src/main/java/io/mosip/compliance/toolkit/service/ReportService.java, mosip-compliance-toolkit/src/main/java/io/mosip/compliance/toolkit/service/SbiProjectService.java
prepareReadme uses chained StringBuilder.append calls. getPartnerDetails declares IOException and uses isEmpty(). The encryption-key error check uses !isEmpty().

Estimated code review effort: 1 (Trivial) | ~3 minutes

Poem

Builders append words in line,
Empty checks now state the sign.
Exceptions narrow, clear, and bright,
Three small services read just right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the service-layer changes that address SonarQube code smells S3024, S112, and S1155.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant