amounts

package
v1.0.0-alpha.40 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 6 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 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

func Read(ctx context.Context, host Host, ref string) Setting

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.

Jump to

Keyboard shortcuts

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