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

package stylecheck

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

Index

Variables

var Analyzers = map[string]*analysis.Analyzer{
	"ST1000": {
		Name:     "ST1000",
		Run:      CheckPackageComment,
		Doc:      Docs["ST1000"].String(),
		Requires: []*analysis.Analyzer{},
		Flags:    newFlagSet(),
	},
	"ST1001": {
		Name:     "ST1001",
		Run:      CheckDotImports,
		Doc:      Docs["ST1001"].String(),
		Requires: []*analysis.Analyzer{facts.Generated, config.Analyzer},
		Flags:    newFlagSet(),
	},
	"ST1003": {
		Name:     "ST1003",
		Run:      CheckNames,
		Doc:      Docs["ST1003"].String(),
		Requires: []*analysis.Analyzer{facts.Generated, config.Analyzer},
		Flags:    newFlagSet(),
	},
	"ST1005": {
		Name:     "ST1005",
		Run:      CheckErrorStrings,
		Doc:      Docs["ST1005"].String(),
		Requires: []*analysis.Analyzer{buildssa.Analyzer},
		Flags:    newFlagSet(),
	},
	"ST1006": {
		Name:     "ST1006",
		Run:      CheckReceiverNames,
		Doc:      Docs["ST1006"].String(),
		Requires: []*analysis.Analyzer{buildssa.Analyzer, facts.Generated},
		Flags:    newFlagSet(),
	},
	"ST1008": {
		Name:     "ST1008",
		Run:      CheckErrorReturn,
		Doc:      Docs["ST1008"].String(),
		Requires: []*analysis.Analyzer{buildssa.Analyzer},
		Flags:    newFlagSet(),
	},
	"ST1011": {
		Name:  "ST1011",
		Run:   CheckTimeNames,
		Doc:   Docs["ST1011"].String(),
		Flags: newFlagSet(),
	},
	"ST1012": {
		Name:     "ST1012",
		Run:      CheckErrorVarNames,
		Doc:      Docs["ST1012"].String(),
		Requires: []*analysis.Analyzer{config.Analyzer},
		Flags:    newFlagSet(),
	},
	"ST1013": {
		Name:     "ST1013",
		Run:      CheckHTTPStatusCodes,
		Doc:      Docs["ST1013"].String(),
		Requires: []*analysis.Analyzer{facts.Generated, facts.TokenFile, config.Analyzer},
		Flags:    newFlagSet(),
	},
	"ST1015": {
		Name:     "ST1015",
		Run:      CheckDefaultCaseOrder,
		Doc:      Docs["ST1015"].String(),
		Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated, facts.TokenFile},
		Flags:    newFlagSet(),
	},
	"ST1016": {
		Name:     "ST1016",
		Run:      CheckReceiverNamesIdentical,
		Doc:      Docs["ST1016"].String(),
		Requires: []*analysis.Analyzer{buildssa.Analyzer},
		Flags:    newFlagSet(),
	},
	"ST1017": {
		Name:     "ST1017",
		Run:      CheckYodaConditions,
		Doc:      Docs["ST1017"].String(),
		Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated, facts.TokenFile},
		Flags:    newFlagSet(),
	},
	"ST1018": {
		Name:     "ST1018",
		Run:      CheckInvisibleCharacters,
		Doc:      Docs["ST1018"].String(),
		Requires: []*analysis.Analyzer{inspect.Analyzer},
		Flags:    newFlagSet(),
	},
}
var Docs = map[string]*lint.Documentation{
	"ST1000": &lint.Documentation{
		Title: `Incorrect or missing package comment`,
		Text:  "" /* 167 byte string literal not displayed */,

		Since:      "2019.1",
		NonDefault: true,
	},

	"ST1001": &lint.Documentation{
		Title: `Dot imports are discouraged`,
		Text:  "" /* 898 byte string literal not displayed */,

		Since:   "2019.1",
		Options: []string{"dot_import_whitelist"},
	},

	"ST1003": &lint.Documentation{
		Title: `Poorly chosen identifier`,
		Text:  "" /* 359 byte string literal not displayed */,

		Since:      "2019.1",
		NonDefault: true,
		Options:    []string{"initialisms"},
	},

	"ST1005": &lint.Documentation{
		Title: `Incorrectly formatted error string`,
		Text:  "" /* 497 byte string literal not displayed */,

		Since: "2019.1",
	},

	"ST1006": &lint.Documentation{
		Title: `Poorly chosen receiver name`,
		Text:  "" /* 749 byte string literal not displayed */,

		Since: "2019.1",
	},

	"ST1008": &lint.Documentation{
		Title: `A function's error value should be its last return value`,
		Text:  `A function's error value should be its last return value.`,
		Since: `2019.1`,
	},

	"ST1011": &lint.Documentation{
		Title: `Poorly chosen name for variable of type time.Duration`,
		Text:  "" /* 280 byte string literal not displayed */,

		Since: `2019.1`,
	},

	"ST1012": &lint.Documentation{
		Title: `Poorly chosen name for error variable`,
		Text: `Error variables that are part of an API should be called errFoo or
ErrFoo.`,
		Since: "2019.1",
	},

	"ST1013": &lint.Documentation{
		Title: `Should use constants for HTTP error codes, not magic numbers`,
		Text:  "" /* 359 byte string literal not displayed */,

		Since:   "2019.1",
		Options: []string{"http_status_code_whitelist"},
	},

	"ST1015": &lint.Documentation{
		Title: `A switch's default case should be the first or last case`,
		Since: "2019.1",
	},

	"ST1016": &lint.Documentation{
		Title:      `Use consistent method receiver names`,
		Since:      "2019.1",
		NonDefault: true,
	},

	"ST1017": &lint.Documentation{
		Title: `Don't use Yoda conditions`,
		Text:  "" /* 324 byte string literal not displayed */,

		Since: "2019.2",
	},

	"ST1018": &lint.Documentation{
		Title: `Avoid zero-width and control characters in string literals`,
		Since: "2019.2",
	},
}

Functions

func CheckBlankImports

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

func CheckContextFirstArg

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

func CheckDefaultCaseOrder

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

func CheckDotImports

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

func CheckErrorReturn

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

func CheckErrorStrings

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

func CheckErrorVarNames

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

func CheckHTTPStatusCodes

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

func CheckIncDec

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

func CheckInvisibleCharacters

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

func CheckNames

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

func CheckPackageComment

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

func CheckReceiverNames

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

func CheckReceiverNamesIdentical

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

func CheckTimeNames

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

func CheckUnexportedReturn

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

CheckUnexportedReturn checks that exported functions on exported types do not return unexported types.

func CheckYodaConditions

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

Source Files

analysis.go doc.go lint.go names.go

Version
v0.0.0-2019.2.1
Published
Jun 27, 2019
Platform
js/wasm
Imports
21 packages
Last checked
6 minutes ago

Tools for package owners.