lint

package module
v0.0.0-...-77f87e4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

README

evg-lint is a linter for common problems encountered in the Evergreen codebase

Installation

Golint requires Go 1.6 or later.

go get -u github.com/evergreen-ci/evg-lint/evg-lint

Usage

Invoke evg-lint exactly as you would golint

Linters

Testify

Alerts to the use of "Teardown" or "SetUp", which should be "TearDown" and "Setup" respectively in testify suites. Requires that the receiver struct have "suite.Suite", or another inline struct with suite.Suite

Cancelled Spell Check

To aid in grep use, we prefer the AmE spelling "canceled" as opposed to the BrE spelling "cancelled". This alerts to the use of the BrE spelling. By default, these errors are not reported. (0.7 confidence; min is 0.8)

Defer in for loops

Using defer in a for loop has the often unintended consequence of delaying the defer method until function close, while we mentally expect the defer to run at the end of every loop body.

License

This package derives heavily from golint, and remains under the same license

Documentation

Overview

Package lint contains a linter for Go source code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Linter

type Linter struct {
}

A Linter lints Go source code.

func (*Linter) Lint

func (l *Linter) Lint(filename string, src []byte) ([]Problem, error)

Lint lints src.

func (*Linter) LintFiles

func (l *Linter) LintFiles(files map[string][]byte) ([]Problem, error)

LintFiles lints a set of files of a single package. The argument is a map of filename to source.

type Problem

type Problem struct {
	Position   token.Position // position in source file
	Text       string         // the prose that describes the problem
	Link       string         // (optional) the link to the style guide for the problem
	Confidence float64        // a value in (0,1] estimating the confidence in this problem's correctness
	LineText   string         // the source line
	Category   string         // a short name for the general category of the problem

	// If the problem has a suggested fix (the minority case),
	// ReplacementLine is a full replacement for the relevant line of the source file.
	ReplacementLine string
}

Problem represents a problem in some source code.

func (*Problem) String

func (p *Problem) String() string

Directories

Path Synopsis
evg-lint lints the Go source files named on its command line.
evg-lint lints the Go source files named on its command line.

Jump to

Keyboard shortcuts

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