adityamparikh opened a new pull request, #268:
URL: https://github.com/apache/solr-mcp/pull/268
Stacked on #267, which is stacked on #266: the first two commits here are
#266 and #267, and only the top commit (`fix: resolve the open SonarCloud
issues`) is new.
## What
Resolves every open issue SonarCloud reports for `apache_solr-mcp` on
`main`: 44 code smells, no bugs or vulnerabilities. #267 already fixes 5 of
them (four unthrown `throws Exception` clauses and the unused
`createMockUpdateHandlerData`). This PR fixes the other 39. The "new issues" on
#264–#267 are a subset of these, flagged because reformatting touched those
lines.
### Main code
| Rule | Where | Fix |
|---|---|---|
| S1118, S1186 | `SolrNativeHints` | It was an empty `@Configuration` whose
only job was to import its nested `Registrar`. The class is now the
`RuntimeHintsRegistrar` itself, and `SolrConfig` imports it with
`@ImportRuntimeHints(SolrNativeHints.class)`. That leaves one bean and one
nested class fewer, and the same hints. |
| S1186 | `Main`, `SolrConfig` constructors | These exist only to carry
Javadoc (javadoc warns on an implicit constructor; see #146). The body now says
so. |
| S1186, S108 | `MarkdownDocumentCreator` | The empty
`addImplicitResolvers()` override and the `case null -> {}` branch each get a
comment saying why they are empty. |
| S6213, S9391 | `MarkdownDocumentCreator` | The loop with a variable named
`record` is now a stream, and so is the source-span loop. |
| S9391 | `JsonDocumentCreator` | The array loop is now a `filter`/`map`
stream; `isContainer()` replaces `isObject() \|\| isArray()`. |
| S8491 | `Dtos` | Javadoc on record components is dangling: the javadoc
tool ignores it. The 38 component comments are now `@param` tags on each
record, and the stray file-level comment above `SolrMetrics` is gone. |
| S125 | `CollectionService` | A comment containing `totalTime/requests`
read as commented-out code; it's reworded. |
| S3457 | `CollectionService` | The prompt's purpose line is now built by
concatenation, not `"\n...%s\n".formatted(...)`. The `\n` is prompt text, so
`%n` would be wrong. |
| S7467 | `SolrConfigurationProperties` | The unused catch parameter is now
`_`. |
| S1075 | `SolrConfig` | `NOSONAR`, with a comment. The `"/"` is a URL path
separator. The rule's remedy, `File.separator`, would put a `\` into the Solr
URL on Windows. |
| S1874 | `buildSrc` `GenerateBinaryLicense` | CycloneDX 13 deprecates
`LicenseChoice.getLicenses()` and `getExpression()`, so licenses are now read
through `getItems()`. A new test covers the SPDX-expression branch, which had
no test. |
### Tests
| Rule | Where | Fix |
|---|---|---|
| S2699 | `MainTest.contextLoads` | It had no assertion. It now asserts that
each Solr-calling service in the context is its mock. |
| S5976, S4144 | `DistributedTracingTest` | `shouldCreateSpanHierarchy`,
`shouldSetCorrectSpanKind`, and `shouldIncludeServiceNameInResource` had
identical bodies that only checked some span exists, which
`shouldCreateSpanForSearchServiceMethod` already does. Their names promised
checks `SimpleTracer` can't make, so they are removed, along with the class
Javadoc's hierarchy claim. |
| S5778 | `SchemaServiceTest`, `SearchServiceTest`,
`SearchServiceIntegrationTest`, `SortClauseTest` | Arguments are built before
`assertThrows`, so only the call under test can throw. |
| S2925 | `DockerImageStdioIntegrationTest` | `Thread.sleep(5000)` is now
Awaitility's `during(5s)`, which also fails as soon as the container exits. |
| S1172 | `ClientHttp` | `main(String[] args)` is now `static void main()`,
matching `ClientStdio`. |
| S9397 | `BuildInfoReader`, `ClientStdio` | `String.format` with plain `%s`
slots is now concatenation. |
## Verification
- `./gradlew build` passes: 452 tests, none skipped or failed. That's #267's
455 minus the three removed tracing duplicates.
- `./gradlew -p buildSrc test` passes all 13 tests, including the new
SPDX-expression test.
- `./gradlew nativeTest -Pnative` passes, with 299 tests successful and none
failed. It covers the `SolrNativeHints` move, since the native binary only
starts if the hints are registered.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]