Documentation
¶
Overview ¶
Package amounts decides whether what Costroid posts on a repository shows amounts. It is the comment.show_cost rule, read the same way for the report's comment and for a check posted again on an approval, by costroid approve and by the approve button of costroid serve.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Host ¶
type Host interface {
// ReadFile reads a file at a ref. A missing file is scm.ErrNotFound.
ReadFile(ctx context.Context, path, ref string) ([]byte, error)
Visibility(ctx context.Context) (scm.Visibility, error)
}
Host is the repository the rule reads.
type Setting ¶
type Setting struct {
Amounts comment.Amounts
// Config is the comment's settings as costroid.yml states them at the
// commit, nil when the file could not be read.
Config *comment.Config
// Unread says why costroid.yml could not be read, and Unseen why the
// repository's visibility could not. Each is nil when the read succeeded
// or the rule did not need it.
Unread, Unseen error
// Warnings are what costroid.yml holds that the comment does not read as
// written, each the line comment.ParseConfig gives for it. Read prints
// none of them: a command prints each, and a service logs it.
Warnings []string
}
Setting is what the rule found on one repository.
func Read ¶
Read applies the rule to costroid.yml at the commit ref and to the repository's visibility. A file that leaves comment.show_cost on shows amounts, and so does a private repository whatever the file says. A public repository whose file turns the setting off withholds them. When the file or the visibility cannot be read, a repository not known to be private withholds them, as unsettled.