fix: resolve top 5 SonarQube issues (weekly sweep)#562
Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Open
fix: resolve top 5 SonarQube issues (weekly sweep)#562devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Conversation
- S1948 (CRITICAL): mark InvalidRequestException.errors as transient - S1452 (CRITICAL): replace ResponseEntity<?> with ResponseEntity<Map<String, Object>> in ArticleApi.article - S1452 (CRITICAL): replace ResponseEntity<?> with ResponseEntity<Map<String, Object>> in ArticleApi.updateArticle - S1452 (CRITICAL): replace ResponseEntity<?> with ResponseEntity<Map<String, Object>> in CommentsApi.createComment - S3415 (MAJOR): swap assertEquals args so expected comes before actual in ArticleQueryServiceTest.should_fetch_article_success Co-Authored-By: Kyu Choi <kyuhwanchoi0423@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Weekly SonarQube sweep. Ranked open issues by severity → type → effort → recency and fixed the top 5 (4 CRITICAL + 1 MAJOR). All changes are minimal and scoped to the exact lines flagged.
AZ1u3HBdEnUkF3fpjVtNjava:S1948— Fields in a Serializable class should be transient or serializableInvalidRequestException.java:7errors(SpringErrors, notSerializable) astransient.AZ1u3HCaEnUkF3fpjVtjjava:S1452— Generic wildcard types should not be used in return typesArticleApi.java:36ResponseEntity<?>→ResponseEntity<Map<String, Object>>onarticle(...).AZ1u3HCaEnUkF3fpjVtkjava:S1452ArticleApi.java:45ResponseEntity<?>→ResponseEntity<Map<String, Object>>onupdateArticle(...).AZ1u3HBkEnUkF3fpjVtQjava:S1452CommentsApi.java:41ResponseEntity<?>→ResponseEntity<Map<String, Object>>oncreateComment(...).AZ1u3HJJEnUkF3fpjVwbjava:S3415— Assertion arguments in wrong orderArticleQueryServiceTest.java:65assertEquals(fetched.getFavoritesCount(), 0)→assertEquals(0, fetched.getFavoritesCount())../gradlew testpasses locally../gradlew spotlessCheckfails on both this branch andmasterdue to a pre-existing JDK 17 incompatibility between Spotless 6.2.1 / Google Java Format and thejdk.compilermodule (IllegalAccessErroroncom.sun.tools.javac.parser.Tokens$TokenKind). Not introduced by this PR. The repo has no CI workflows, so this does not block merging, but the underlying tooling should probably be upgraded in a follow-up.Review & Testing Checklist for Human
ResponseEntity<Map<String, Object>>inArticleApi/CommentsApiis acceptable. The existing bodies areHashMap<String, Object>subclasses, so this compiles and serializes identically, but if any caller/consumer depends on the raw/wildcard type at the source level (e.g., other controllers, tests, or tooling), double-check it still compiles.InvalidRequestException.errorstransientis acceptable. If the exception ever gets serialized (e.g., distributed caches, session replication), the validation errors will benullafter deserialization. In practice this exception is only thrown/caught within a single JVM via@ControllerAdvice, so this should be safe../gradlew teststill passes in your environment.Notes
Link to Devin session: https://app.devin.ai/sessions/24d4dee58c10454a8966573cd192f2d8
Requested by: @choikh0423