Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AnnotationReader = &analysis.Analyzer{ Name: "annotationreader", Doc: "Reads @implements, @immutable, @constructor, @packageonly annotations from code", Run: runAnnotationReader, Requires: []*analysis.Analyzer{ ConfigReader, }, FactTypes: []analysis.Fact{ (*annotations.AnnotationReaderFact)(nil), }, ResultType: reflect.TypeOf(annotations.PackageAnnotations{}), }
AnnotationReader reads annotations from code and exports them as facts
var ConfigReader = &analysis.Analyzer{ Name: "config", Doc: "Reads configuration from environment variables and command line flags", Run: runConfig, ResultType: reflect.TypeOf(config.Empty()), Flags: *config.CreateFlagSet(), }
ConfigReader reads configuration from environment variables and command line flags This analyzer must run first to provide configuration to other analyzers IMPORTANT: Name "config" is required for proper flag prefixing by multichecker Do not change the analyzer name as it affects command-line flag names
var ConstructorChecker = &analysis.Analyzer{ Name: "constructorchecker", Doc: "Checks that types with @constructor are only instantiated in declared constructors", Run: runConstructorChecker, Requires: []*analysis.Analyzer{ ConfigReader, AnnotationReader, IgnoreReader, }, FactTypes: []analysis.Fact{ (*annotations.ConstructorCheckerFact)(nil), }, }
ConstructorChecker checks @constructor annotations
var IgnoreReader = &analysis.Analyzer{ Name: "ignorereader", Doc: "Reads @ignore CODE1, CODE2 annotations from code", Run: runIgnoreReader, Requires: []*analysis.Analyzer{ ConfigReader, }, ResultType: reflect.TypeOf(ignore.IgnoreResult{}), }
IgnoreReader reads @ignore annotations from code
var ImmutableChecker = &analysis.Analyzer{ Name: "immutabilitychecker", Doc: "Checks that types marked as @immutable follow immutability rules", Run: runImmutableChecker, Requires: []*analysis.Analyzer{ ConfigReader, AnnotationReader, IgnoreReader, }, FactTypes: []analysis.Fact{ (*annotations.ImmutableCheckerFact)(nil), }, }
ImmutableChecker checks @immutable annotations
var ImplementsChecker = &analysis.Analyzer{ Name: "implementschecker", Doc: "Checks that types implement interfaces as declared by @implements", Run: runImplementsChecker, Requires: []*analysis.Analyzer{ ConfigReader, AnnotationReader, IgnoreReader, }, FactTypes: []analysis.Fact{ (*annotations.ImplementsCheckerFact)(nil), }, }
ImplementsChecker checks @implements annotations
var PackageOnlyChecker = &analysis.Analyzer{ Name: "packageonlychecker", Doc: "Checks that @packageonly items are only used in allowed packages", Run: runPackageOnlyChecker, Requires: []*analysis.Analyzer{ ConfigReader, AnnotationReader, IgnoreReader, }, FactTypes: []analysis.Fact{ (*annotations.PackageOnlyCheckerFact)(nil), }, }
PackageOnlyChecker checks @packageonly annotations
var TestOnlyChecker = &analysis.Analyzer{ Name: "testonlychecker", Doc: "Checks that @testonly items are only used in test files", Run: runTestOnlyChecker, Requires: []*analysis.Analyzer{ ConfigReader, AnnotationReader, IgnoreReader, }, FactTypes: []analysis.Fact{ (*annotations.TestOnlyCheckerFact)(nil), }, }
TestOnlyChecker checks @testonly annotations
Functions ¶
func AllAnalyzers ¶
AllAnalyzers returns all available analyzers
Types ¶
This section is empty.