comments

package
v0.66.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Prefix = "pint"

	IgnoreFileComment     = "ignore/file"
	IgnoreLineComment     = "ignore/line"
	IgnoreBeginComment    = "ignore/begin"
	IgnoreEndComment      = "ignore/end"
	IgnoreNextLineComment = "ignore/next-line"
	FileOwnerComment      = "file/owner"
	RuleOwnerComment      = "rule/owner"
	FileDisableComment    = "file/disable"
	DisableComment        = "disable"
	FileSnoozeComment     = "file/snooze"
	SnoozeComment         = "snooze"
	RuleSetComment        = "rule/set"
)

Functions

func IsRuleComment

func IsRuleComment(typ Type) bool

func Only

func Only[T any](src []Comment, typ Type) []T

Types

type Comment

type Comment struct {
	Value  CommentValue
	Type   Type
	Offset int
}

func Parse

func Parse(lineno int, text string) (comments []Comment)

type CommentError added in v0.53.0

type CommentError struct {
	Err  error
	Line int
}

func (CommentError) Error added in v0.53.0

func (ce CommentError) Error() string

type CommentValue

type CommentValue interface {
	String() string
}

type Disable

type Disable struct {
	Match string
}

func (Disable) String

func (d Disable) String() string

type Invalid

type Invalid struct {
	Err CommentError
}

func (Invalid) String

func (i Invalid) String() string

type Owner

type Owner struct {
	Name string
}

func (Owner) String

func (o Owner) String() string

type RuleSet

type RuleSet struct {
	Value string
}

func (RuleSet) String

func (r RuleSet) String() string

type Snooze

type Snooze struct {
	Until time.Time
	Match string
}

func (Snooze) String

func (s Snooze) String() string

type Type

type Type uint8
const (
	UnknownType Type = iota
	InvalidComment
	IgnoreFileType     // ignore/file
	IgnoreLineType     // ignore/line
	IgnoreBeginType    // ignore/begin
	IgnoreEndType      // ignore/end
	IgnoreNextLineType // ignore/next-line
	FileOwnerType      // file/owner
	RuleOwnerType      // rule/owner
	FileDisableType    // file/disable
	DisableType        // disable
	FileSnoozeType     // file/snooze
	SnoozeType         // snooze
	RuleSetType        // rule/set
)

Jump to

Keyboard shortcuts

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