configlint

package
v0.167.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package configlint finds config keys that can be deleted without changing what gofer actually runs with (`gofer config lint`, gofer-arsj). The test for every key is empirical: delete it, load the config again through the real loader and the real agent defaults, and compare the effective result. No separate rule table is kept, so the verdicts follow whatever the defaults are in this build.

Index

Constants

View Source
const (
	KindRemove  = "remove"  // the key can be deleted (`--fix` deletes it)
	KindExtends = "extends" // the agent can be rewritten with extends: builtin (hint only)
	KindUnknown = "unknown" // gofer does not know the key and ignores it (typo?); never fixed
)

Finding kinds.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	File       string // absolute path
	Line       int    // 1-based line of the key
	Path       string // dotted key path, e.g. agents.claude.detect
	Kind       string
	Reason     string
	Suggestion string // KindExtends: the rewritten agent block
	Lines      int    // lines saved
}

Finding is one report line.

type FixResult

type FixResult struct {
	Removed []Finding
	Backups []string
}

FixResult describes what Fix changed.

func Fix

func Fix(mainPath string, kind Target) (FixResult, error)

Fix deletes every removable key, one at a time on the current text, keeping a deletion only while the effective config stays the same (two keys can each be redundant alone yet not together). Each changed file is backed up first; the result is loaded again and compared before Fix returns — any difference restores all files.

type Report

type Report struct {
	Main     string
	Files    []string
	Findings []Finding
}

Report is the result of Lint.

func Lint

func Lint(mainPath string, kind Target) (Report, error)

Lint reports the keys of the config at mainPath (and its included files) that can be deleted without changing the effective config, and the agents that could be written as `extends: builtin`. It never writes a file.

func (Report) Removable

func (r Report) Removable() (keys, lines int)

Removable counts the KindRemove findings and the lines they free.

type Target added in v0.143.0

type Target string

Target selects the kind of file being linted.

const (
	TargetServer Target = "server" // config.yaml (with its include files)
	TargetWorker Target = "worker" // worker.yaml
)

Jump to

Keyboard shortcuts

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