Skip to content

refactor: resolve SonarCloud quick-win code smells - #110

Merged
nyg merged 3 commits into
masterfrom
nyg/sonar-scan-quick-wins-c65f31
Sep 21, 2026
Merged

nyg merged 3 commits into
masterfrom
nyg/sonar-scan-quick-wins-c65f31

Conversation

@nyg

@nyg nyg commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Resolves the open SonarCloud code smells reported on nyg_kraken-api-java, fixing the mechanical ones and suppressing the ones that reflect deliberate API design.

Tests

  • S5778 (46): builder validation tests now build the Lombok builder before assertThatThrownBy(builder::build), so the lambda holds a single call that can throw.
  • S1612 (18): KrakenAPI credential tests use method references such as unit::accountBalance instead of lambdas.
  • S5838: LedgerInfoEndpointTest asserts with containsEntry.
  • S1130: removed an unused throws Exception from TradeVolumeEndpointTest.

Library

  • S1192: DefaultKrakenRestRequester uses a CONTENT_TYPE constant for the header name.
  • S7467: DepositLimitDeserializer and LimitValueDeserializer catch NumberFormatException with an unnamed variable.
  • S6353: JsonPostParams matches the nonce with \d instead of [0-9], which is equivalent since Java's \d is ASCII-only by default.
  • S1488: WalletAccountsParams.params() returns the map directly.
  • S1168: CreateFundingWithdrawalParams.fee() returns an empty map instead of null when no fee option is set, and body() only adds fee when it is not empty. A set fee always contains quoted_fee or current_fee, so the encoded body is unchanged.

Suppressed

  • S1452 on PostParams.params(): subclasses override it returning either Map<String, String> or Map<String, Object>, which the wildcard allows; removing it would break subclasses of the published API.
  • S6539 on KrakenAPI: it is the single entry point exposing every endpoint by design.
  • S1168 on FundingBetaParams.body(): null is the documented way for an endpoint to send no body, distinct from an empty JSON object.

Remaining

  • S1135 (4): TODO comments that need a design decision rather than a mechanical fix.

@sonarqubecloud

Copy link
Copy Markdown

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@nyg
nyg merged commit 2a4b70a into master Sep 21, 2026
6 checks passed
@nyg
nyg deleted the nyg/sonar-scan-quick-wins-c65f31 branch September 21, 2026 20:17
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.

2 participants