Documentation
¶
Overview ¶
Package targets provides maturity target definitions for different project stages.
Index ¶
- Variables
- func DiscoverTargets(dir string) (map[string]Target, error)
- func GetValidCheckIDs() (map[string]bool, []string)
- func Init() error
- func LoadUserTargets() (map[string]Target, error)
- func Names() []string
- func ValidateAllUserTargets() map[string]validation.ValidationResult
- func ValidateTarget(t Target, validCheckIDs map[string]bool, validIDList []string) validation.ValidationResult
- func WriteBuiltInTargets() error
- type Source
- type Target
Constants ¶
This section is empty.
Variables ¶
var BuiltInTargets = map[string]Target{ "poc": { Name: "poc", Description: "Proof of Concept - minimal checks for early development", Disabled: []string{ "common:license", "common:sast", "common:changelog", "common:precommit", "common:env", "common:contributing", "common:secrets", "common:config_validation", "common:retry", "common:editorconfig", "go:coverage", "go:deps", "go:cyclomatic", "go:logging", "go:race", "python:coverage", "python:deps", "python:complexity", "python:logging", "node:coverage", "node:deps", "node:logging", "java:coverage", "java:deps", "java:logging", "rust:coverage", "rust:deps", "rust:logging", "typescript:coverage", "typescript:deps", "typescript:logging", }, }, "production": { Name: "production", Description: "Production application - all checks enabled", Disabled: []string{}, }, }
BuiltInTargets contains the predefined maturity targets.
Functions ¶
func DiscoverTargets ¶
DiscoverTargets finds all YAML files in a directory and loads them as targets.
func GetValidCheckIDs ¶ added in v0.5.1
GetValidCheckIDs returns all valid check IDs from the registry.
func Init ¶
func Init() error
Init loads user targets from the config directory. This should be called once at application startup. It's safe to call multiple times; subsequent calls are no-ops.
func LoadUserTargets ¶
LoadUserTargets discovers and loads user targets from the config directory. Returns an empty map if the directory doesn't exist or is empty.
func ValidateAllUserTargets ¶ added in v0.5.1
func ValidateAllUserTargets() map[string]validation.ValidationResult
ValidateAllUserTargets validates all user-defined targets. Returns a map of target name to validation result.
func ValidateTarget ¶ added in v0.5.1
func ValidateTarget(t Target, validCheckIDs map[string]bool, validIDList []string) validation.ValidationResult
ValidateTarget validates a single target against the check registry.
func WriteBuiltInTargets ¶
func WriteBuiltInTargets() error
WriteBuiltInTargets writes all built-in targets to the user config directory. This is used by the "targets init" command.
Types ¶
type Target ¶
type Target struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Disabled []string `yaml:"disabled"`
Source Source `yaml:"-"` // Not serialized to YAML
}
Target defines a set of checks to disable for a specific maturity level.
func Get ¶
Get returns a target by name and whether it was found. User targets take precedence over built-in targets.
func List ¶
func List() []Target
List returns all available targets in a consistent order. User targets are listed after built-in targets, both sorted by name.
func LoadFromFile ¶
LoadFromFile loads a single target from a YAML file.