Refactor main.go to reduce cyclomatic complexity

Breaks down large functions into smaller, focused helpers to pass gocyclo linter:

Auto-import refactoring:
- Extract parseJSONLIssues() to handle JSONL parsing
- Extract handleCollisions() to detect and report conflicts
- Extract importIssueData() to coordinate issue/dep/label imports
- Extract updateExistingIssue() and createNewIssue() for clarity
- Extract importDependencies() and importLabels() for modularity

Flush refactoring:
- Extract recordFlushFailure() and recordFlushSuccess() for state management
- Extract readExistingJSONL() to isolate file reading logic
- Extract fetchDirtyIssuesFromDB() to separate DB access
- Extract writeIssuesToJSONL() to handle atomic writes

Command improvements:
- Extract executeLabelCommand() to eliminate duplication in label.go
- Extract addLabelsToIssue() helper for label management
- Replace deprecated strings.Title with manual capitalization

Configuration:
- Add gocyclo exception for test files in .golangci.yml

All tests passing, no functionality changes.
This commit is contained in:
Joshua Shanks
2025-10-15 21:06:17 -07:00
committed by Steve Yegge
parent cf4f11cff7
commit b1e8ef556e
6 changed files with 787 additions and 680 deletions

View File

@@ -86,3 +86,4 @@ issues:
- dupl # Test duplication is acceptable
- goconst # Test constants are acceptable
- errcheck # Test cleanup errors are acceptable
- gocyclo # Test complexity is acceptable