targets

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package targets provides maturity target definitions for different project stages.

Index

Constants

This section is empty.

Variables

View Source
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

func DiscoverTargets(dir string) (map[string]Target, error)

DiscoverTargets finds all YAML files in a directory and loads them as targets.

func GetValidCheckIDs added in v0.5.1

func GetValidCheckIDs() (map[string]bool, []string)

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

func LoadUserTargets() (map[string]Target, error)

LoadUserTargets discovers and loads user targets from the config directory. Returns an empty map if the directory doesn't exist or is empty.

func Names

func Names() []string

Names returns the names of all available targets.

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 Source

type Source string

Source indicates where a target is defined.

const (
	SourceBuiltIn Source = "built-in"
	SourceUser    Source = "user"
)

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

func Get(name string) (Target, bool)

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

func LoadFromFile(path string) (*Target, error)

LoadFromFile loads a single target from a YAML file.

Jump to

Keyboard shortcuts

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