toolshonnef.co/go/tools/quickfix Index | Files

package quickfix

import "honnef.co/go/tools/quickfix"

Index

Variables

var Analyzers = lint.InitializeAnalyzers(Docs, map[string]*analysis.Analyzer{
	"QF1001": {
		Run:      CheckDeMorgan,
		Requires: []*analysis.Analyzer{inspect.Analyzer},
	},
	"QF1002": {
		Run:      CheckTaglessSwitch,
		Requires: []*analysis.Analyzer{inspect.Analyzer},
	},
	"QF1003": {
		Run:      CheckIfElseToSwitch,
		Requires: []*analysis.Analyzer{inspect.Analyzer},
	},
	"QF1004": {
		Run:      CheckStringsReplaceAll,
		Requires: []*analysis.Analyzer{inspect.Analyzer},
	},
	"QF1005": {
		Run:      CheckMathPow,
		Requires: []*analysis.Analyzer{inspect.Analyzer},
	},
	"QF1006": {
		Run:      CheckForLoopIfBreak,
		Requires: []*analysis.Analyzer{inspect.Analyzer},
	},
	"QF1007": {
		Run:      CheckConditionalAssignment,
		Requires: []*analysis.Analyzer{inspect.Analyzer},
	},
	"QF1008": {
		Run:      CheckExplicitEmbeddedSelector,
		Requires: []*analysis.Analyzer{inspect.Analyzer, facts.TokenFile},
	},
	"QF1009": {
		Run:      CheckTimeEquality,
		Requires: []*analysis.Analyzer{inspect.Analyzer},
	},
	"QF1010": {
		Run:      CheckByteSlicePrinting,
		Requires: []*analysis.Analyzer{inspect.Analyzer},
	},
	"QF1011": sharedcheck.RedundantTypeInDeclarationChecker("could", true),
})
var Docs = lint.Markdownify(map[string]*lint.Documentation{
	"QF1001": {
		Title:    "Apply De Morgan's law",
		Since:    "2021.1",
		Severity: lint.SeverityHint,
	},

	"QF1002": {
		Title: "Convert untagged switch to tagged switch",
		Text:  "" /* 291 byte string literal not displayed */,

		Since:    "2021.1",
		Severity: lint.SeverityHint,
	},

	"QF1003": {
		Title: "Convert if/else-if chain to tagged switch",
		Text:  "" /* 269 byte string literal not displayed */,

		Since:    "2021.1",
		Severity: lint.SeverityInfo,
	},

	"QF1004": {
		Since:    "2021.1",
		Severity: lint.SeverityHint,
	},

	"QF1005": {
		Title: "Expand call to `math.Pow`",
		Text: `Some uses of \'math.Pow\' can be simplified to basic multiplication.

Before:

	math.Pow(x, 2)

After:

	x * x`,
		Since:    "2021.1",
		Severity: lint.SeverityHint,
	},

	"QF1006": {
		Title: "Lift if+break into loop condition",
		Text: `Before:

	for {
		if done {
			break
		}
		...
	}

After:

	for !done {
		...
	}`,
		Since:    "2021.1",
		Severity: lint.SeverityHint,
	},

	"QF1007": {
		Title: "Merge conditional assignment into variable declaration",
		Text: `Before:

	x := false
	if someCondition {
		x = true
	}

After:

	x := someCondition
`,
		Since:    "2021.1",
		Severity: lint.SeverityHint,
	},

	"QF1008": {
		Title:    "Omit embedded fields from selector expression",
		Since:    "2021.1",
		Severity: lint.SeverityHint,
	},

	"QF1009": {
		Title:    `Use time.Time.Equal instead of \'==\' operator`,
		Since:    "2021.1",
		Severity: lint.SeverityInfo,
	},

	"QF1010": {
		Title:    "Convert slice of bytes to string when printing it",
		Since:    "2021.1",
		Severity: lint.SeverityHint,
	},

	"QF1011": {
		Title:    "Omit redundant type from variable declaration",
		Since:    "2021.1",
		Severity: lint.SeverityHint,
	},
})

Functions

func CheckByteSlicePrinting

func CheckByteSlicePrinting(pass *analysis.Pass) (interface{}, error)

func CheckConditionalAssignment

func CheckConditionalAssignment(pass *analysis.Pass) (interface{}, error)

func CheckDeMorgan

func CheckDeMorgan(pass *analysis.Pass) (interface{}, error)

func CheckExplicitEmbeddedSelector

func CheckExplicitEmbeddedSelector(pass *analysis.Pass) (interface{}, error)

func CheckForLoopIfBreak

func CheckForLoopIfBreak(pass *analysis.Pass) (interface{}, error)

func CheckIfElseToSwitch

func CheckIfElseToSwitch(pass *analysis.Pass) (interface{}, error)

func CheckMathPow

func CheckMathPow(pass *analysis.Pass) (interface{}, error)

func CheckStringsReplaceAll

func CheckStringsReplaceAll(pass *analysis.Pass) (interface{}, error)

func CheckTaglessSwitch

func CheckTaglessSwitch(pass *analysis.Pass) (interface{}, error)

func CheckTimeEquality

func CheckTimeEquality(pass *analysis.Pass) (interface{}, error)

Source Files

analysis.go doc.go lint.go

Version
v0.3.0-0.dev
Published
May 25, 2021
Platform
darwin/amd64
Imports
17 packages
Last checked
39 minutes ago

Tools for package owners.