feat: add file complexity analyzer for review prioritization#36
feat: add file complexity analyzer for review prioritization#36SimonOyaneder wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
||
| // ── Types ──────────────────────────────────────────────────────────── | ||
|
|
||
| interface file_analysis_result { |
There was a problem hiding this comment.
🟡 Naming Convention · medium · confidence: 99%
Type/interface names use snake_case instead of PascalCase.
Existing pattern: Interfaces are PascalCase (e.g., IndexProgress, RepoParams, PullRequestInfo).
Reference: src/intelligence/indexer.ts
| interface file_analysis_result { | |
| interface FileAnalysisResult { | |
| filePath: string; | |
| tokenCount: number; | |
| contentHash: string; | |
| complexityScore: number; | |
| } | |
| interface AnalysisSummary { | |
| totalFiles: number; | |
| totalTokens: number; | |
| highComplexityFiles: string[]; | |
| } |
|
|
||
| // ── Helpers ────────────────────────────────────────────────────────── | ||
|
|
||
| const compute_content_hash = (content: string): string => { |
There was a problem hiding this comment.
🔴 Duplicated Code · high · confidence: 98%
Reimplements hashing logic instead of using the shared hash utility.
Existing pattern: Hashing file/content strings is centralized via sha256Hash from src/lib/hash and reused by intelligence/github handlers.
Reference: src/intelligence/indexer.ts
| const compute_content_hash = (content: string): string => { | |
| import { sha256Hash } from "../lib/hash"; | |
| const computeContentHash = (content: string): string => { | |
| return sha256Hash(content).slice(0, 16); | |
| }; |
|
|
||
| // ── Concurrency helper ─────────────────────────────────────────────── | ||
|
|
||
| const run_in_parallel = async <T, R>( |
There was a problem hiding this comment.
🔴 Duplicated Code · high · confidence: 97%
Adds a local concurrency mapper instead of using the shared concurrency utility.
Existing pattern: Parallel async mapping is centralized via mapWithConcurrency from src/lib/concurrency and reused in intelligence/github flows.
Reference: src/intelligence/indexer.ts
| const run_in_parallel = async <T, R>( | |
| import { mapWithConcurrency } from "../lib/concurrency"; | |
| const results = await mapWithConcurrency( | |
| entries, | |
| 5, | |
| async ([path, content]) => analyzeSingleFile(path, content), | |
| ); |
| ); | ||
| } | ||
| await client.query("COMMIT"); | ||
| } catch (err) { |
There was a problem hiding this comment.
🟡 Pattern Violation · medium · confidence: 95%
Catch variable name and rethrow pattern deviates from repository transaction pattern (error / throw error).
Existing pattern: DB transaction blocks catch error, rollback, then throw error.
Reference: CANON.md
| } catch (err) { | |
| } catch (error) { | |
| await client.query("ROLLBACK"); | |
| throw error; | |
| } |
Summary
Test plan