Documentation
¶
Overview ¶
Package checks contains default checks included with the Thrift linter.
Index ¶
- Variables
- func CheckAnnotations(patterns []*AnnotationPattern, checks thriftlint.Checks) thriftlint.Check
- func CheckDefaultValues() thriftlint.Check
- func CheckEnumSequence() thriftlint.Check
- func CheckIndentation() thriftlint.Check
- func CheckMapKeys() thriftlint.Check
- func CheckNames(matches map[reflect.Type]NamingStyle, blacklist map[string]bool) thriftlint.Check
- func CheckOptional() thriftlint.Check
- func CheckStructFieldOrder() thriftlint.Check
- func CheckTypeReferences() thriftlint.Check
- type AnnotationPattern
- type NamingStyle
Constants ¶
This section is empty.
Variables ¶
var ( // CheckNamesDefaults is a map of Thrift AST node type to a regular expression for // validating names of that type. CheckNamesDefaults = map[reflect.Type]NamingStyle{ thriftlint.ServiceType: upperCamelCaseStyle, thriftlint.EnumType: upperCamelCaseStyle, thriftlint.StructType: upperCamelCaseStyle, thriftlint.EnumValueType: upperSnakeCaseStyle, thriftlint.FieldType: lowerCamelCaseStyle, thriftlint.MethodType: lowerCamelCaseStyle, thriftlint.ConstantType: upperSnakeCaseStyle, } // CheckNamesDefaultBlacklist is names that should never be used for symbols. CheckNamesDefaultBlacklist = map[string]bool{ "class": true, "int": true, } )
Functions ¶
func CheckAnnotations ¶
func CheckAnnotations(patterns []*AnnotationPattern, checks thriftlint.Checks) thriftlint.Check
CheckAnnotations validates Thrift annotations against regular expressions.
All supported annotations must be represented.
NOTE: This should be the last check added in order to correctly validate the allowed values for "nolint".
func CheckDefaultValues ¶
func CheckDefaultValues() thriftlint.Check
CheckDefaultValues checks that default values are not provided.
func CheckEnumSequence ¶
func CheckEnumSequence() thriftlint.Check
CheckEnumSequence checks that enums start with 0 and increment sequentially.
func CheckIndentation ¶
func CheckIndentation() thriftlint.Check
CheckIndentation checks indentation is a multiple of 2.
func CheckMapKeys ¶
func CheckMapKeys() thriftlint.Check
CheckMapKeys verifies that map keys are valid types.
func CheckNames ¶
func CheckNames(matches map[reflect.Type]NamingStyle, blacklist map[string]bool) thriftlint.Check
CheckNames checks Thrift symbols comply with a set of regular expressions.
If matches or blacklist are nil, global defaults will be used.
func CheckOptional ¶
func CheckOptional() thriftlint.Check
CheckOptional ensures that all Thrift fields are optional, as is generally accepted best practice for Thrift.
func CheckStructFieldOrder ¶
func CheckStructFieldOrder() thriftlint.Check
CheckStructFieldOrder ensures that struct field IDs are present in-order in the file.
func CheckTypeReferences ¶
func CheckTypeReferences() thriftlint.Check
CheckTypeReferences checks that types referenced in Thrift files are actually imported and exist.