hardcodedfilepath

package
v0.79.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package hardcodedfilepath implements a Go analysis linter that flags hard-coded file path string literals and compares them against a known set of file path constants. When a literal value matches an existing named constant, the linter reports it with a suggestion to use the constant. When no matching constant exists, the linter reports it as a candidate for extraction into a named constant.

The linter also correlates path literals with logging and print calls, annotating those findings with an extra note, because paths in log output are especially important to keep consistent via named constants.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "hardcodedfilepath",
	Doc:      "reports hard-coded file path string literals that should be replaced with named constants",
	URL:      "https://github.com/github/gh-aw/tree/main/pkg/linters/hardcodedfilepath",
	Requires: []*analysis.Analyzer{inspect.Analyzer},
	Run:      run,
}

Analyzer is the hardcoded-file-path analysis pass.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL