scale

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InAuto   = "auto"
	InLabels = "labels"
	InField  = "field"
	InWeight = "weight"
)

How a setting says where an axis is kept: detected, a family of labels named by its prefix, a field named, or GitLab's weight (the effort only).

View Source
const HiddenSaid = "a level hidden here"

HiddenSaid says a value visible to an organisation's members only, on a public repository: set, never shown (ADR-0040).

View Source
const WeightSaid = "GitLab's weight"

WeightSaid names GitLab's weight where the role says an effort is kept.

Variables

View Source
var (
	Priority = Scale{Axis: "priority", Names: []string{"Urgent", "High", "Medium", "Low"}, None: 5, /* contains filtered or unexported fields */}
	Effort   = Scale{Axis: "effort", Names: []string{"Low", "Medium", "High"}, None: 2, /* contains filtered or unexported fields */}
)

The two scales (ADR-0040, "Two axes, the forge's levels, read by name").

View Source
var Before = Scheme{Priority: Source{Family: Own, Said: ownSaid}, Effort: Source{Family: Family{Scale: Effort}}}

Before is the scheme before ADR-0040's detection, a project's setting unset: workline's own priority labels; no effort, read nowhere.

View Source
var Own = own()

Own is workline's own priority labels, workline:priority/1, the most pressing, to /4, the most pressing the warmest: the family the role writes until ADR-0040's detection finds a project's.

View Source
var Used = Before

Used is the scheme the engine reads and writes issues with: Before, until Use sets the one detected on the project a process reads.

View Source
var WeightFamily = weightFamily()

WeightFamily is GitLab's weight as a family: each level and the weight written for it, "weight 1" to "weight 5", as the role's texts say it. An issue's weight is read in bands (Weight), never by these names.

Functions

func Cell added in v0.34.0

func Cell(p, e int) string

Cell is an issue's place in the value-vs-effort grid, as Next says it: "High · Effort Low → quick win"; a value missing said so, "no priority, effort not estimated".

func EffortAnchor added in v0.34.0

func EffortAnchor(l int) string

EffortAnchor is what an effort level means to build: hours, days, weeks; "" for none.

func EffortValue added in v0.34.0

func EffortValue(l int) string

EffortValue is an effort level as the role's texts say it: its name, and the label that carries it ("Low (effort/small)"); "not estimated" for none.

func PriorityName added in v0.34.0

func PriorityName(l int) string

PriorityName is a priority level by its name; "no priority" for none.

func Said

func Said(l int) string

Said is a priority level in a sentence: "priority 2"; "no priority" for none.

func Stuck added in v0.34.0

func Stuck(s Scale, levels []int) string

Stuck says an axis's estimates stuck on one value (ADR-0040): past 10 values set, one over 60% of them, said "Medium on 8 of the 11"; "" when not.

func Use added in v0.34.0

func Use(s Scheme)

Use sets the scheme the engine reads and writes issues with, detected on the project this process reads (Detect): a process reads one.

func Value

func Value(l int) string

Value is a priority level as the role's texts say it: its number, 1 the most pressing, as workline's own labels write it, and the label that carries it when the project keeps its own ("1 (P0)"); "none" for none.

func Weight

func Weight(w int) int

Weight is the effort level of a GitLab weight, a whole number: 0 or 1 Low, 2 or 3 Medium, 4 or more High; none for a weight below 0.

func WeightOf

func WeightOf(l int) int

WeightOf is the weight written for an effort level: 1, 3 or 5, on both common point scales (1, 2, 3, 5, 8 and 1 to 5); 0 for none.

Types

type Family

type Family struct {
	Scale  Scale
	Prefix string
	Labels []Label
}

Family is where a project keeps an axis: labels that carry its levels, each read by its name, or a field's options. Prefix starts each label of a family of labels; "" for a field's options. Its labels are in the order of their levels: the first of a level is the one written.

func Labels

func Labels(s Scale, prefix string, labels []string) (Family, error)

Labels reads a project's family of labels by name: each label starting with prefix, its rest a number or a word. Numbers count from the family's own start, 0 when it has a 0, else 1 (Scale.Number): a family created a label at a time, its first label never made, still reads its second as the second level. A prefix ending in a letter or a digit takes numbers only — P0, effort1: hours —, so P-critical belongs to another family and Performance to none. A word no table knows carries no level, and the error names it, to be said once.

func Options

func Options(s Scale, options []string) (Family, error)

Options reads a field's options by name, never by their position: a forge lists them as its owner arranged them, an Effort field heaviest first. An option no table knows carries no level, and the error names it, to be said once.

func Words added in v0.34.0

func Words(s Scale, scoped bool) Family

Words are the forge's words for an axis, created when the role first sets one: on GitHub, the fields' option names, priority/urgent to priority/low and effort/low to effort/high, so a repository moved to an organisation maps them one to one; on GitLab (scoped), the ranked priority::1 to ::4, its own "Label priority" sort then following the role's, and effort::low to ::high.

func (Family) First

func (f Family) First(names []string) int

First is the first level in the order's direction names carry — the most pressing priority, the lightest effort —; 0 when they carry none.

func (Family) Label

func (f Family) Label(l int) (Label, bool)

Label is the label written for level l: the family's first carrying it; ok is false when none does.

func (Family) Levels

func (f Family) Levels(names []string) []int

Levels are the levels names carry in the family, in the names' order; a name outside it carries none.

func (Family) Of

func (f Family) Of(name string) int

Of is the level a name of the family carries; 0 when it carries none.

func (Family) Others

func (f Family) Others(l int) []string

Others are the family's names but the one written for level l: those taken off when it is set.

func (Family) Span added in v0.34.0

func (f Family) Span() string

Span says a family as the summary does: "P0 to P3" for numbers after a letter, else its prefix and a star, "priority/*".

type Field added in v0.34.0

type Field struct {
	ID      int64
	Name    string
	Options []string
	Hidden  bool
	Blind   string
}

Field is a single-select issue field of the forge an axis may be kept in (ADR-0040): its options as its owner arranged them; Hidden, its values visible to the organisation's members only on a public repository, or a visibility not read; Blind, why this token reads no hidden value, "" when it does.

type Label

type Label struct {
	Name  string
	Level int
	Color string
	About string
	Rank  int
}

Label is one name of a family and the level it carries. Color, About and Rank, for a label the role creates: its colour, what it says of itself, and its rank where the forge ranks labels — GitLab's prioritized labels, 1 listed first —, 0 for none.

func (Label) Describe

func (l Label) Describe(by string) string

Describe is what a label the role creates says of itself, by the role named.

type On added in v0.34.0

type On struct {
	Labels []string
	Fields map[string]string
	Weight *int
}

On is what an issue carries where an axis may be kept: its labels, its values in the forge's issue fields, by name, and its GitLab weight, nil for none.

type Scale

type Scale struct {
	Axis  string
	Names []string
	// None is where an issue with no value ranks: after the last
	// priority; an effort not estimated as the middle one.
	None int
	// contains filtered or unexported fields
}

Scale is an axis's levels in the order's direction: level 1 is the first name, the most pressing priority or the lightest effort, the last name the last level; 0 is none.

func (Scale) Count

func (s Scale) Count() int

Count is the scale's number of levels.

func (Scale) Name

func (s Scale) Name(l int) string

Name is a level's name; "" for none.

func (Scale) Number

func (s Scale) Number(n, first int) int

Number is the level of the number n in a family numbered from first, 0 or 1: first is the first level, each next number the next one, every number past the last level the last (P0 to P5: Urgent, High, Medium, then Low thrice); 0 below first.

func (Scale) Rank

func (s Scale) Rank(l int) int

Rank is where a level sorts: the level itself, or None for none.

func (Scale) Valid

func (s Scale) Valid(l int) bool

Valid says whether l is one of the scale's levels.

func (Scale) Word

func (s Scale) Word(name string) (int, bool)

Word is the level a word names, whatever its case: a level's own name, or one a project or a forge uses for it (critical, small, weeks); ok is false when no table knows it.

type Scheme

type Scheme struct {
	Priority Source
	Effort   Source
	// Detected: the project's settings asked where it keeps them
	// (ADR-0040): each value is then set once, only where empty, and Next
	// shows each issue's cell of the grid.
	Detected bool
}

Scheme is where the engine reads each axis on a project.

type Setting added in v0.34.0

type Setting struct {
	In     string
	Prefix string         // with In "labels": the family's prefix
	Field  string         // with In "field": the issue field's name
	Names  map[string]int // a label's name, of the family read, to the level the settings give it
}

Setting is where a project's settings say it keeps an axis. Unset (In ""), the engine reads as before the detection (Before).

func ReadSetting added in v0.34.0

func ReadSetting(s Scale, v any) (Setting, error)

ReadSetting reads an axis's setting: unset, `auto`, or a map — `in` (auto, labels, field, or weight for the effort), `prefix` with labels, `name` with field, `names` mapping a label of the family to a level. Anything else is an error, never read as unset.

func (Setting) Set added in v0.34.0

func (s Setting) Set() bool

Set says whether the project's settings name where the axis is kept.

type Source added in v0.34.0

type Source struct {
	Family Family
	// Said is where, as the run's summary says it: "labels P0 to P3, the
	// project's"; "" when the axis is read nowhere.
	Said string
	// Words: the forge's words, each created when the role first sets
	// one — all of them, ranked where the forge ranks labels.
	Words bool
	// Others are the axis's other families on the project: read to tell
	// a value kept in another place, never written.
	Others []Family
	// Unknown names the labels of the family no table knows, nor the
	// settings map: read as none, said once.
	Unknown error
	// Field: the issue field the axis is kept in, its Family its options;
	// "" when it is kept in labels. OtherField, a field of the axis the
	// project has beside the labels read: a value there is elsewhere.
	Field      Field
	OtherField string
	// Weight: the effort is kept in GitLab's weight (Premium, Ultimate),
	// read in bands, written 1, 3 or 5, never on a parent (ADR-0040).
	// OtherWeight: the project keeps a weight beside the labels read, a
	// value there elsewhere.
	Weight      bool
	OtherWeight bool
}

Source is where the engine reads and writes an axis on a project.

func Detect added in v0.34.0

func Detect(s Scale, set Setting, labels, open []string, scoped bool, fields []Field, weights bool) (Source, error)

Detect finds where a project keeps an axis (ADR-0040, "Where the values live"), with no agent. labels are the project's, open those on its open issues; scoped says the forge's labels are GitLab's; fields, its issue fields; weights, that its issues carry GitLab's weight. Unset, as before the detection (Before). Else the setting's field, weight or family; else the forge's own field named as the axis, Priority or Effort; else, for the effort, GitLab's weight; else the project's own family, two values or more and one on an open issue; else workline's own priority labels, one on an open issue; else the forge's words. A setting naming a field, a weight or a family the project lacks is an error: the run stops, never reading another.

func (Source) Elsewhere added in v0.34.0

func (s Source) Elsewhere(on On) []string

Elsewhere are where an issue carries the axis outside its source — its labels of another family, or a field or a weight beside them —: a value there is never written over, nor mirrored (ADR-0040).

func (Source) Hidden added in v0.34.0

func (s Source) Hidden() bool

Hidden says whether the axis's values are visible to the organisation's members only, on a public repository: never shown in the role's comment, its state, nor the job's summary (ADR-0040).

func (Source) InField added in v0.34.0

func (s Source) InField() bool

InField says whether the axis is kept in an issue field.

func (Source) Native added in v0.34.0

func (s Source) Native() bool

Native says whether the axis is kept in the forge's own place, a field or GitLab's weight, rather than in labels.

func (Source) Place added in v0.34.0

func (s Source) Place() string

Place says where the axis is kept, as a sentence names it: "the field Priority", "GitLab's weight", "P0 to P3".

func (Source) Read added in v0.34.0

func (s Source) Read(on On) []int

Read are the levels an issue carries on the axis: its field's value, its weight read in bands, or its labels of the family.

Jump to

Keyboard shortcuts

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