config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config reads .signpost.yml, the one file a repository uses to state how it wants to be analysed.

[ADR 0011] decides three things this package exists to enforce, and each of them is a rule about what a file may *not* do:

  • It is read from the repository root and nowhere else. No user-level file, no XDG_CONFIG_HOME, no --config pointing outside the tree, no walk upward. A config search path is how the same checkout starts producing different bundles for two people, and the byte-stability the committed bundle rests on (design §8.1) does not survive that.
  • A key may only change a default. Anything that decides whether a check *fails* — as_of_bundle, fail_on_cycle, a threshold — stays a flag, because a repository that can weaken its own gate by committing a file is not gated. Those keys are refused by name.
  • There is nowhere to put a credential ([ADR 0009]). The file is committed, and a format with a place for an API key is a format that eventually has one in it.

Nothing here is tolerant

That is the difference between this reader and the ones in internal/manifest, and it is worth stating because the two share a parser. Those readers step over what they cannot interpret, deliberately (ADR 0001): they read files other people wrote for other tools, and one unusual Helm template must not fail a build. This file is signpost's own, written for signpost, by somebody who expected it to have an effect. So *any* diagnostic is a usage error — not only the malformed ones. `include_vendored true`, missing its colon, is a line the tolerant reader notes and steps over, and stepping over it would mean the run analysed the repository the way the file said not to while reporting success.

[ADR 0011]: ../../docs/adr/0011-configuration-file-format-and-location.md [ADR 0009]: ../../docs/adr/0009-the-semantic-pass-is-opt-in-and-egress-is-explicit.md

Index

Constants

View Source
const File = ".signpost.yml"

File is the name, at the repository root and nowhere else.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	IncludeVendored bool
	IncludeFixtures bool
	Ignore          []string
	NoHistory       bool
	MaxCommits      int
	Repo            string
	Backend         string
	Model           string

	// HooksCheck is `hooks.check`, the local hook's check mode. The one nested key, and the
	// reason for the nesting: `hooks` names a command group, so a flat `check:` would be a
	// key whose meaning depends on knowing which command reads it.
	HooksCheck string
}

Config is what a repository may say about its own analysis.

Every field sets the *default* for a flag, and each one is a fact about the repository that is the same for every caller — which is the test ADR 0011 applies to decide whether a key may exist at all. A zero field means the file did not say, and the flag's own default stands: for the booleans that coincides with false, and for MaxCommits with vcs's default, so there is no need to record which keys were present.

func Load

func Load(root string) (*Config, error)

Load reads the file from root.

An absent file is the supported normal case and returns an empty Config with no error — not a warning, since most repositories will never have one. Everything else that goes wrong is an error the caller maps to exit 2.

Jump to

Keyboard shortcuts

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