🔍 Duplicate Code Detected: Project config parsing scaffold
Analysis of commit f7374e8
Summary
The create/update project handlers repeat the same config-parsing skeleton: log start, allocate config, set default max, read github-token, read project-specific overrides, and emit a summary log. The repeated scaffold spans 3 handlers and is large enough to justify extraction.
Duplication Details
Pattern: Project config parsing scaffold
- Severity: Medium
- Occurrences: 3
- Locations:
pkg/workflow/create_project.go (lines 17-64)
pkg/workflow/update_project.go (lines 35-84)
pkg/workflow/create_project_status_update.go (lines 16-48)
- Shared logic:
- check for the config key
- initialize a config struct
- set a default
max value
- parse
github-token
- parse a project identifier/URL override
- log a final summary
Impact Analysis
- Maintainability: fixes to defaults or token parsing need to be repeated in multiple handlers.
- Bug Risk: drift between the three parsers can create inconsistent behavior for project-related workflows.
- Code Bloat: the same parsing skeleton is copy-pasted instead of centralized.
Refactoring Recommendations
-
Extract a shared project-config helper for the common scaffold.
- Suggested target:
pkg/workflow/project_config_helpers.go
- Scope: default max, token override, project override, and summary logging.
-
Keep handler-specific parsing in small callbacks.
create-project can keep views and field-definitions logic.
update-project can keep target-repo, allowed-repos, and validation logic.
create-project-status-update can keep its status-update-specific fields.
Analysis Metadata
- Analyzed Files: 3
- Detection Method: Serena semantic code analysis
- Commit: f7374e8
- Analysis Date: 2026-06-18
Generated by 🔍 Duplicate Code Detector · ◷
🔍 Duplicate Code Detected: Project config parsing scaffold
Analysis of commit f7374e8
Summary
The create/update project handlers repeat the same config-parsing skeleton: log start, allocate config, set default max, read
github-token, read project-specific overrides, and emit a summary log. The repeated scaffold spans 3 handlers and is large enough to justify extraction.Duplication Details
Pattern: Project config parsing scaffold
pkg/workflow/create_project.go(lines 17-64)pkg/workflow/update_project.go(lines 35-84)pkg/workflow/create_project_status_update.go(lines 16-48)maxvaluegithub-tokenImpact Analysis
Refactoring Recommendations
Extract a shared project-config helper for the common scaffold.
pkg/workflow/project_config_helpers.goKeep handler-specific parsing in small callbacks.
create-projectcan keepviewsandfield-definitionslogic.update-projectcan keeptarget-repo,allowed-repos, and validation logic.create-project-status-updatecan keep its status-update-specific fields.Analysis Metadata