disablerule

package
v0.43.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	PrefixDisable     = `protolint:disable`
	PrefixEnable      = `protolint:enable`
	PrefixDisableNext = `protolint:disable:next`
	PrefixDisableThis = `protolint:disable:this`
)

comment prefix

Variables

View Source
var (
	ReDisable     = regexp.MustCompile(PrefixDisable + ` (.*)`)
	ReEnable      = regexp.MustCompile(PrefixEnable + ` (.*)`)
	ReDisableNext = regexp.MustCompile(PrefixDisableNext + ` (.*)`)
	ReDisableThis = regexp.MustCompile(PrefixDisableThis + ` (.*)`)
)

comment prefix regexp

Functions

This section is empty.

Types

type Interpreter

type Interpreter struct {
	// contains filtered or unexported fields
}

Interpreter represents an interpreter for disable rule comments.

func NewInterpreter

func NewInterpreter(
	ruleID string,
) *Interpreter

NewInterpreter creates an Interpreter.

func (*Interpreter) CallEachIfValid

func (i *Interpreter) CallEachIfValid(
	lines []string,
	f func(index int, line string),
)

CallEachIfValid calls a given function each time the line is not disabled.

func (*Interpreter) Interpret

func (i *Interpreter) Interpret(
	comments []*parser.Comment,
	inlines ...*parser.Comment,
) (isDisabled bool)

Interpret interprets comments and returns a bool whether not apply the rule to a next or this element.

Jump to

Keyboard shortcuts

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