Skip to content

[lint-monster] chore: Extract hard-coded file paths to constants (120 instances) #38772

@github-actions

Description

@github-actions

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

  1. Group by category: Separate .github/ paths, /tmp/gh-aw/ paths, and ${RUNNER_TEMP}/ paths
  2. Create constants module: Consider extending pkg/constants/constants.go with a new subsection for path constants
  3. Replace inline literals: Update each finding to reference the constant
  4. Validate: Run make golint-custom to verify all findings are resolved
  5. 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 ·

  • expires on Jun 18, 2026, 7:50 PM UTC-08:00

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions