Documentation
¶
Overview ¶
Package themecheck detects styles that are frozen to the default theme.
internal/styles exposes the palette as package-level *variables* that ApplyTheme reassigns at runtime. Anything that reads one of those variables while building a value in a package-level `var` block — or in an `init()` — is evaluated once, at program init, before any theme has been applied. It therefore keeps the default theme's colours forever, and the bug is invisible to anyone running the default theme.
This package walks the module's source and reports every such site, so a test can fail when the pattern reappears.
Index ¶
Constants ¶
const StylesPkgPath = "github.com/marcus/sidecar/internal/styles"
StylesPkgPath is the import path of the package whose exported variables are reassigned when the theme changes.
Variables ¶
This section is empty.
Functions ¶
func HasDotImport ¶
HasDotImport reports whether any file under root dot-imports the styles package, which would hide theme references from the scanner.
Types ¶
type Finding ¶
type Finding struct {
File string // path relative to the scanned root
Line int
Name string // the package-level identifier being initialised
Symbol string // the styles.* symbol it froze
}
Finding is one package-level value that captures a theme colour at init.
func Scan ¶
Scan walks root, finds the theme-mutable symbols exported by the styles package, and reports every package-level value elsewhere in the module that is initialised from one of them.
If root contains no styles package (as in the analyzer's own fixtures), the caller-supplied mutable set is used instead; see ScanWith.