Hard-coded File Path Refactoring
Finding count: 120 instances of hard-coded file paths that should be extracted as named constants
Root cause
File paths (both relative and absolute) are scattered throughout the codebase as inline string literals. Extracting them to module-level or package-level constants improves maintainability and reduces the risk of typos.
Affected patterns
Repository paths (.github/...)
.github/workflows/ and .github/workflows
.github/agents/
.github/
Temporary directories (/tmp/gh-aw/...)
/tmp/gh-aw/agent-stdio.log
/tmp/gh-aw/aw-prompts/prompt.txt
/tmp/gh-aw/mcp-logs/, /tmp/gh-aw/mcp-config/
/tmp/gh-aw/difc-proxy-tls/, /tmp/gh-aw/proxy-logs/
/tmp/gh-aw/agent/, /tmp/gh-aw/safeoutputs/
Environment variable paths (${RUNNER_TEMP}/...)
${RUNNER_TEMP}/gh-aw/
${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json
Sample diagnostics
pkg/constants/constants.go:362:9: hard-coded file path ".github/workflows": consider extracting as a named constant
pkg/workflow/agentic_engine.go:348:9: hard-coded file path "/tmp/gh-aw/agent-stdio.log": consider extracting as a named constant
pkg/workflow/awf_helpers.go:234:13: hard-coded file path "${RUNNER_TEMP}/gh-aw": use constant constants.GhAwRootDirShell instead of inline string literal
pkg/parser/mcp.go:346:11: hard-coded file path "/tmp/gh-aw/mcp-logs:/tmp/gh-aw/mcp-logs": consider extracting as a named constant
Affected subsystems
pkg/workflow/ (~70 findings)
pkg/parser/ (~30 findings)
pkg/constants/ (~10 findings)
pkg/cli/ (~10 findings)
Remediation approach
- Group by category: Separate .github/ paths, /tmp/gh-aw/ paths, and ${RUNNER_TEMP}/ paths
- Create constants module: Consider extending
pkg/constants/constants.go with a new subsection for path constants
- Replace inline literals: Update each finding to reference the constant
- Validate: Run
make golint-custom to verify all findings are resolved
- Test: Ensure no behavioral changes by running the test suite
Notes
- Most of these are straightforward replacements with low risk
- Some paths may have environment variable expansion that needs careful handling
- Consider grouping related paths in a structure or multiple constants for clarity
Generated by 🧌 LintMonster · 122.5 AIC · ⌖ 4.52 AIC · ⊞ 20.2K · ◷
Hard-coded File Path Refactoring
Finding count: 120 instances of hard-coded file paths that should be extracted as named constants
Root cause
File paths (both relative and absolute) are scattered throughout the codebase as inline string literals. Extracting them to module-level or package-level constants improves maintainability and reduces the risk of typos.
Affected patterns
Repository paths (.github/...)
.github/workflows/and.github/workflows.github/agents/.github/Temporary directories (/tmp/gh-aw/...)
/tmp/gh-aw/agent-stdio.log/tmp/gh-aw/aw-prompts/prompt.txt/tmp/gh-aw/mcp-logs/,/tmp/gh-aw/mcp-config//tmp/gh-aw/difc-proxy-tls/,/tmp/gh-aw/proxy-logs//tmp/gh-aw/agent/,/tmp/gh-aw/safeoutputs/Environment variable paths (${RUNNER_TEMP}/...)
${RUNNER_TEMP}/gh-aw/${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.jsonSample diagnostics
Affected subsystems
pkg/workflow/(~70 findings)pkg/parser/(~30 findings)pkg/constants/(~10 findings)pkg/cli/(~10 findings)Remediation approach
pkg/constants/constants.gowith a new subsection for path constantsmake golint-customto verify all findings are resolvedNotes