(chores): fix SonarCloud S1871 duplicate branch violations#22551
(chores): fix SonarCloud S1871 duplicate branch violations#22551orpiske wants to merge 1 commit intoapache:mainfrom
Conversation
…DSL modules Merge duplicate conditional branches that have identical implementations, addressing 79 SonarCloud S1871 violations. Changes include combining if-else branches with || operators, extracting helper methods for complex conditions, using Set-based lookups for repeated equality checks, and consolidating switch case fall-throughs. Claude Code on behalf of Otavio R. Piske Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
orpiske
left a comment
There was a problem hiding this comment.
I'm not very satisfied w/ the results on this one. I'm likely going to close it without merge on Monday.
| } else if (MACHINE_TRANSLATION.getPath().equals(applicationPath)) { | ||
| return new CustomNlpPredictor<String>(endpoint); | ||
| } else if (MULTIPLE_CHOICE.getPath().equals(applicationPath)) { | ||
| } else if (TEXT_GENERATION.getPath().equals(applicationPath) |
There was a problem hiding this comment.
I'm not sure if this is better.
| if (!inWord && !doNotIncludeSymbols.contains(String.valueOf(c))) { | ||
| curToken.append(c); | ||
| } else if ('"' != c || (!curToken.isEmpty() && curToken.charAt(curToken.length() - 1) == '\\')) { | ||
| if ((!inWord && !doNotIncludeSymbols.contains(String.valueOf(c))) |
There was a problem hiding this comment.
Does it look better? I'm not convinced on this one ..
|
🧪 CI tested the following changed modules:
💡 Manual integration tests recommended:
Build reactor — dependencies compiled but only changed modules were tested (35 modules)
|
Summary
||operatorsmatchesTemplateKey(),isConsoleLogDependency(),isSimpleExpression())Set-based lookup forHealthCheckHelper.isReservedKey()replacing 13 duplicate branchesMethodBodySourceCodeEmitterTest plan
mvn -DskipTests install)mvn formatter:format impsort:sortClaude Code on behalf of Otavio R. Piske