todos

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMatchPhrases = []string{"TODO", "FIXME", "OPTIMIZE", "HACK", "XXX", "WTF", "LEGACY"}

DefaultMatchPhrases are the phrase markers matched when no custom list is supplied.

Functions

func WriteTodos

func WriteTodos(todos ToDos, writer io.Writer) error

WriteTodos renders a report of todos

func WriteTodosWithOptions added in v0.0.17

func WriteTodosWithOptions(todos ToDos, writer io.Writer, options ReportOptions) error

WriteTodosWithOptions renders a report of todos with explicit report options.

Types

type BlameLookupFailure added in v0.0.17

type BlameLookupFailure struct {
	FilePath string
	Lines    []int
	Err      error
}

BlameLookupFailure is a non-fatal failure to find git blame for one file.

func (BlameLookupFailure) Error added in v0.0.17

func (f BlameLookupFailure) Error() string

func (BlameLookupFailure) Unwrap added in v0.0.17

func (f BlameLookupFailure) Unwrap() error

type BlameLookupFailures added in v0.0.17

type BlameLookupFailures []BlameLookupFailure

BlameLookupFailures collects non-fatal blame lookup failures.

func (BlameLookupFailures) Error added in v0.0.17

func (f BlameLookupFailures) Error() string

type ColorMode added in v0.0.17

type ColorMode string

ColorMode controls ANSI color rendering in human-readable reports.

const (
	ColorAuto   ColorMode = "auto"
	ColorAlways ColorMode = "always"
	ColorNever  ColorMode = "never"
)

func ParseColorMode added in v0.0.17

func ParseColorMode(value string) (ColorMode, bool)

ParseColorMode converts a CLI color mode value to a report color mode.

type ContextLine added in v0.0.17

type ContextLine struct {
	Line int
	Text string
}

ContextLine is one source line rendered around a finding.

type ReportOptions added in v0.0.17

type ReportOptions struct {
	Color ColorMode
}

ReportOptions configures human-readable report rendering.

type ToDo

type ToDo struct {
	comments.Comment
	String  string
	Phrase  string
	Blame   *blame.Blame
	Context []ContextLine
}

ToDo represents a ToDo item

func NewToDo

func NewToDo(comment comments.Comment) *ToDo

NewToDo produces a pointer to a ToDo from a comment

func NewToDoWithPhrases added in v0.0.17

func NewToDoWithPhrases(comment comments.Comment, startingMatchPhrases []string) *ToDo

NewToDoWithPhrases produces a pointer to a ToDo from a comment and explicit phrase list.

func (*ToDo) TimeAgo

func (t *ToDo) TimeAgo() string

TimeAgo returns a human readable string indicating the time since the todo was added

type ToDos

type ToDos []*ToDo

ToDos represents a list of ToDo items

func NewToDos

func NewToDos(comments comments.Comments) ToDos

NewToDos produces a list of ToDos from a list of comments

func (ToDos) CountWithCommits

func (t ToDos) CountWithCommits() (count int)

CountWithCommits returns the number of todos with an associated commit (in which that todo was added)

func (*ToDos) FindBlame

func (t *ToDos) FindBlame(ctx context.Context, dir string) error

FindBlame sets the blame information on each todo in a set of todos

func (ToDos) FindContext added in v0.0.17

func (t ToDos) FindContext(dir string, contextLines int) error

FindContext sets source context lines around each todo.

func (ToDos) Len

func (t ToDos) Len() int

Len returns the number of todos

func (ToDos) Less

func (t ToDos) Less(i, j int) bool

Less compares two todos by their creation time

func (ToDos) Swap

func (t ToDos) Swap(i, j int)

Swap swaps two todos

Jump to

Keyboard shortcuts

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