Skip to content

Sonar: 250+ functions exceed cognitive complexity threshold #44

Description

@sirdeggen

Tracking issue for #38.

Rule Count Description
typescript:S3776 237 Cognitive Complexity of functions should not be too high
go:S3776 13 (Go) Cognitive Complexity of functions should not be too high
typescript:S3358 59 Ternary operators should not be nested
typescript:S1121 13 Assignments should not be made from within sub-expressions
typescript:S4138 37 for-of should be used over for loop on arrays
typescript:S4144 10 Functions should not have identical implementations

These require human judgment to refactor — extract helpers, flatten conditionals, replace nested ternaries with if-else or lookup tables.

Hot files (issues per file)

  • packages/sdk/src/primitives/Hash.ts — 114 issues
  • packages/wallet/wallet-toolbox/src/WalletPermissionsManager.ts — 84 issues
  • packages/sdk/src/wallet/substrates/WalletWireTransceiver.ts — 60 issues
  • packages/wallet/wallet-toolbox/src/storage/StorageIdb.ts — 50 issues
  • packages/wallet/wallet-toolbox/src/monitor/Monitor.ts — 49 issues
  • packages/sdk/src/primitives/BigNumber.ts — 43 issues
  • packages/sdk/src/transaction/Transaction.ts — 35 issues
  • packages/overlays/overlay-express/src/OverlayExpress.ts — 35 issues

Suggested approach

Pick one hot file at a time. Add unit tests first if missing, then refactor.

Refs: #38

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions