reporter

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package reporter implements an interface that captures the analysis.Pass.Reportf function within it so that it can be wrapped. This provides the ability for consumers of the linters exposed in lintroller to explicitly ignore linter errors for the linters that report on specific lines by way of nolint directives as well as provide the framework within lintroller itself to report lint reports as warnings instead of errors for specific linters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pass

type Pass struct {
	*analysis.Pass
	// contains filtered or unexported fields
}

Pass is a wrapper around *analysis.Pass that accounts for nolint directives as well as any other functionality that it is configured with during initialization with the factory function. Please never initialize this type directly, only through NewPass. If you initialize this type directly, it will essentially be a no-op wrapper around *analysis.Pass.

func NewPass

func NewPass(linter string, pass *analysis.Pass, opts ...PassOption) *Pass

NewPass returns a wrapped version of *analysis.Pass to do reporting that takes account for nolint directives as well as any functionality provided by the functional options passed to this.

func (*Pass) Reportf

func (p *Pass) Reportf(pos token.Pos, format string, args ...interface{})

Reportf is a wrapper around *analysis.Pass.Reportf that respects nolint directives and any other functionality provided by the functional options when Pass was formed with its factory function.

type PassOption

type PassOption func(*Pass)

PassOption is the functional argument type for Pass.

func Warn

func Warn() PassOption

Warn will ensure that all reported lint issues are warnings as opposed to errors for the current linter.

type Reporter

type Reporter interface {
	Reportf(pos token.Pos, format string, args ...interface{})
}

Reporter is a convenience interface that allows Pass to be provided to helper functions in linters who need to be able to use Reportf.

Jump to

Keyboard shortcuts

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