Skip to content

Reduce code duplication across codebase #34

@arkavo-com

Description

@arkavo-com

Summary

SonarCloud analysis shows 5.0% duplicated lines on new code. This technical debt should be addressed to improve maintainability.

Duplication by Directory

Directory Duplication % Duplicated Lines
OpenTDFKit 4.4% 308
OpenTDFKitCLI 6.8% 124
xtest 14.1% 34
OpenTDFKitProfiler 0.0% 0
.github/workflows 0.0% 0
Package.swift 0.0% 0

Areas to investigate

  1. OpenTDFKit (308 lines) - Likely candidates:

    • Crypto operations across TDF/NanoTDF implementations
    • Key derivation code in KeyStore/CryptoHelper
    • Similar encryption/decryption patterns
  2. OpenTDFKitCLI (124 lines) - Likely candidates:

    • Command handling patterns
    • Environment variable parsing
    • File I/O operations
  3. xtest (34 lines) - Lower priority, test/integration code

Suggested approach

  • Run SonarCloud locally to identify specific duplicated blocks
  • Extract common crypto patterns into shared utilities
  • Create protocol extensions for repeated patterns
  • Consider builder/factory patterns for similar object construction

Acceptance criteria

  • Reduce overall duplication to < 3%
  • No duplication in new code contributions
  • Maintain or improve test coverage

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