arkavo-org / arkavo-org/OpenTDFKit

Reduce code duplication across codebase

Open
#34 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
1
Forks
1
Avg merge
9d 4h
Merged PRs (30d)
1

Description

## 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

Contributor guide

No contributing guide indexed for this repository

Research direction

Run SonarCloud locally to identify the specific duplicated blocks in OpenTDFKit, OpenTDFKitCLI, and xtest. Review the reported crypto, key-derivation, command-handling, environment-parsing, and file-I/O patterns before choosing shared utilities or protocol extensions. Done means overall duplication is below 3%, new contributions add no duplication, and test coverage is maintained or improved.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cryptography
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.