Skip to content

refactor: reduce cognitive complexity of StarConnector invocation handler - #2894

Open
hongwei1 wants to merge 1 commit into
OpenBankProject:developfrom
hongwei1:fix/star-connector-invoke-complexity
Open

refactor: reduce cognitive complexity of StarConnector invocation handler#2894
hongwei1 wants to merge 1 commit into
OpenBankProject:developfrom
hongwei1:fix/star-connector-invoke-complexity

Conversation

@hongwei1

Copy link
Copy Markdown
Contributor

Summary

  • SonarCloud flagged scala:S3776 (Cognitive Complexity 39, limit 15, CRITICAL) on the InvocationHandler.invoke introduced in build: migrate obp-api and obp-commons to Scala 2.13 #2890 when the StarConnector interceptor was moved off CGLib's MethodInterceptor onto a JDK InvocationHandler.
  • Splits invoke into delegateToStub, routeToConnector, recordConnectorInboundMetrics, and recordConnectorTrace. No behavioural change — same branching, same metric/trace recording, same correlationId handling (including the existing shadowing inside the trace block).

Test plan

  • mvn -pl obp-api compile — clean build
  • mvn -pl obp-api test -DwildcardSuites="code.bankconnectors.ConnectorProxyObjectMethodsTest,code.bankconnectors.ProxyConnectorTest,code.connector.InternalConnectorTest" — 14/14 passed

…dler

Extract the delegate-to-stub, route-to-connector, and metric/trace
recording logic in the StarConnector InvocationHandler into named
local functions. Behaviour is unchanged; this addresses SonarCloud
scala:S3776 (cognitive complexity 39, limit 15) flagged on the
InvocationHandler introduced when replacing CGLib's MethodInterceptor.
@sonarqubecloud

Copy link
Copy Markdown

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