Preparing report...

Report for github.com/pingcap/parser

A+    Excellent!    Found 31 issues across 71 files

Tweet

gofmt100%

Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command

No problems detected. Good job!


go_vet100%

go vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

No problems detected. Good job!


golint63%

Golint is a linter for Go source code.

    • parser/goyacc/format_yacc.go
    • Line 32: warning: exported function Format should have comment or be unexported (golint)
    • Line 259: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 265: warning: exported type NameArr should have comment or be unexported (golint)
    • Line 310: warning: exported type RuleArr should have comment or be unexported (golint)
    • Line 460: warning: exported type SpecialActionValTransformer should have comment or be unexported (golint)
    • Line 487: warning: exported type OutputFormatter should have comment or be unexported (golint)
    • Line 493: warning: exported method OutputFormatter.Setup should have comment or be unexported (golint)
    • Line 502: warning: exported method OutputFormatter.Teardown should have comment or be unexported (golint)
    • Line 516: warning: exported method OutputFormatter.Format should have comment or be unexported (golint)
    • Line 524: warning: exported type NotNilAssert should have comment or be unexported (golint)
    • Line 540: warning: exported method NotNilAssert.NotNil should have comment or be unexported (golint)
    • Line 544: warning: exported function Ensure should have comment or be unexported (golint)
    • parser/format/format.go
    • Line 198: warning: comment on exported type RestoreFlags should be of the form "RestoreFlags ..." (with optional leading article) (golint)
    • Line 227: warning: exported const DefaultRestoreFlags should have comment (or a comment on this block) or be unexported (golint)
    • Line 284: warning: exported method RestoreFlags.HasStringWithoutDefaultCharset should have comment or be unexported (golint)
    • Line 288: warning: exported method RestoreFlags.HasStringWithoutCharset should have comment or be unexported (golint)
    • parser/auth/auth.go
    • Line 63: warning: exported type RoleIdentity should have comment or be unexported (golint)
    • Line 68: warning: exported method RoleIdentity.Restore should have comment or be unexported (golint)
    • parser/mysql/privs.go
    • Line 247: warning: exported const CreateTMPTablePriv should have comment (or a comment on this block) or be unexported (golint)
    • Line 285: warning: exported type Privileges should have comment or be unexported (golint)
    • Line 287: warning: exported method Privileges.Has should have comment or be unexported (golint)
    • parser/ast/ddl.go
    • Line 204: warning: comment on exported type IndexPartSpecification should be of the form "IndexPartSpecification ..." (with optional leading article) (golint)
    • Line 936: warning: exported type TemporaryKeyword should have comment or be unexported (golint)
    • Line 939: warning: exported const TemporaryNone should have comment (or a comment on this block) or be unexported (golint)
    • Line 1849: warning: exported const TableOptionCharsetWithoutConvertTo should have comment (or a comment on this block) or be unexported (golint)
    • Line 1862: warning: exported method TableOption.Restore should have comment or be unexported (golint)
    • Line 2093: warning: exported method SequenceOption.Restore should have comment or be unexported (golint)
    • Line 2341: warning: exported type TiFlashReplicaSpec should have comment or be unexported (golint)
    • Line 3004: warning: exported var ErrNoParts should have comment or be unexported (golint)
    • Line 3018: warning: exported type SubPartitionDefinition should have comment or be unexported (golint)
    • Line 3023: warning: exported method SubPartitionDefinition.Restore should have comment or be unexported (golint)
    • Line 3035: warning: exported type PartitionDefinitionClause should have comment or be unexported (golint)
    • Line 3044: warning: exported type PartitionDefinitionClauseNone should have comment or be unexported (golint)
    • Line 3054: warning: exported method PartitionDefinitionClauseNone.Validate should have comment or be unexported (golint)
    • Line 3067: warning: exported type PartitionDefinitionClauseLessThan should have comment or be unexported (golint)
    • Line 3097: warning: exported method PartitionDefinitionClauseLessThan.Validate should have comment or be unexported (golint)
    • Line 3113: warning: exported type PartitionDefinitionClauseIn should have comment or be unexported (golint)
    • Line 3164: warning: exported method PartitionDefinitionClauseIn.Validate should have comment or be unexported (golint)
    • Line 3191: warning: exported type PartitionDefinitionClauseHistory should have comment or be unexported (golint)
    • Line 3208: warning: exported method PartitionDefinitionClauseHistory.Validate should have comment or be unexported (golint)
    • Line 3298: warning: exported type PartitionKeyAlgorithm should have comment or be unexported (golint)
    • Line 3439: warning: exported method PartitionOptions.Restore should have comment or be unexported (golint)
    • Line 3477: warning: exported method PartitionOptions.Accept should have comment or be unexported (golint)
    • Line 3581: warning: exported type PlacementActionType should have comment or be unexported (golint)
    • Line 3584: warning: exported const PlacementAdd should have comment (or a comment on this block) or be unexported (golint)
    • Line 3589: warning: exported type PlacementRole should have comment or be unexported (golint)
    • Line 3592: warning: exported const PlacementRoleNone should have comment (or a comment on this block) or be unexported (golint)
    • Line 3599: warning: exported type PlacementSpec should have comment or be unexported (golint)
    • Line 3626: warning: exported method PlacementSpec.Restore should have comment or be unexported (golint)
    • Line 3655: warning: exported method PlacementSpec.Accept should have comment or be unexported (golint)
    • Line 3675: warning: exported method AlterSequenceStmt.Restore should have comment or be unexported (golint)
    • Line 3692: warning: exported method AlterSequenceStmt.Accept should have comment or be unexported (golint)
    • parser/ast/misc.go
    • Line 485: warning: exported const CompletionTypeChain should have comment (or a comment on this block) or be unexported (golint)
    • Line 489: warning: exported method CompletionType.Restore should have comment or be unexported (golint)
    • Line 670: warning: exported const LogTypeDefault should have comment (or a comment on this block) or be unexported (golint)
    • Line 854: warning: exported method SetConfigStmt.Restore should have comment or be unexported (golint)
    • Line 867: warning: exported method SetConfigStmt.Accept should have comment or be unexported (golint)
    • Line 875: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • Line 940: warning: exported type ChangeStmt should have comment or be unexported (golint)
    • Line 987: warning: exported type SetRoleStmt should have comment or be unexported (golint)
    • Line 994: warning: exported method SetRoleStmt.Restore should have comment or be unexported (golint)
    • Line 1029: warning: exported type SetDefaultRoleStmt should have comment or be unexported (golint)
    • Line 1037: warning: exported method SetDefaultRoleStmt.Restore should have comment or be unexported (golint)
    • Line 1135: warning: exported const TslNone should have comment (or a comment on this block) or be unexported (golint)
    • Line 1144: warning: exported type TLSOption should have comment or be unexported (golint)
    • Line 1149: warning: exported method TLSOption.Restore should have comment or be unexported (golint)
    • Line 1176: warning: exported const MaxQueriesPerHour should have comment (or a comment on this block) or be unexported (golint)
    • Line 1182: warning: exported type ResourceOption should have comment or be unexported (golint)
    • Line 1187: warning: exported method ResourceOption.Restore should have comment or be unexported (golint)
    • Line 1205: warning: exported const PasswordExpire should have comment (or a comment on this block) or be unexported (golint)
    • Line 1213: warning: exported type PasswordOrLockOption should have comment or be unexported (golint)
    • Line 1218: warning: exported method PasswordOrLockOption.Restore should have comment or be unexported (golint)
    • Line 1496: warning: exported method CreateBindingStmt.Restore should have comment or be unexported (golint)
    • Line 1514: warning: exported method CreateBindingStmt.Accept should have comment or be unexported (golint)
    • Line 1542: warning: exported method DropBindingStmt.Restore should have comment or be unexported (golint)
    • Line 1562: warning: exported method DropBindingStmt.Accept should have comment or be unexported (golint)
    • Line 2012: warning: exported method RoleOrPriv.ToRole should have comment or be unexported (golint)
    • Line 2022: warning: exported method RoleOrPriv.ToPriv should have comment or be unexported (golint)
    • Line 2224: warning: comment on exported type RevokeRoleStmt should be of the form "RevokeRoleStmt ..." (with optional leading article) (golint)
    • Line 2541: warning: exported type BRIEKind should have comment or be unexported (golint)
    • Line 2542: warning: exported type BRIEOptionType should have comment or be unexported (golint)
    • Line 2545: warning: exported const BRIEKindBackup should have comment (or a comment on this block) or be unexported (golint)
    • Line 2548: warning: comment on exported const BRIEOptionRateLimit should be of the form "BRIEOptionRateLimit ..." (golint)
    • Line 2554: warning: comment on exported const BRIEOptionBackupTimeAgo should be of the form "BRIEOptionBackupTimeAgo ..." (golint)
    • Line 2560: warning: comment on exported const BRIEOptionOnline should be of the form "BRIEOptionOnline ..." (golint)
    • Line 2562: warning: comment on exported const BRIEOptionAnalyze should be of the form "BRIEOptionAnalyze ..." (golint)
    • Line 2570: warning: comment on exported const BRIEOptionCSVBackslashEscape should be of the form "BRIEOptionCSVBackslashEscape ..." (golint)
    • Line 2582: warning: exported type BRIEOptionLevel should have comment or be unexported (golint)
    • Line 2585: warning: exported const BRIEOptionLevelOff should have comment (or a comment on this block) or be unexported (golint)
    • Line 2665: warning: exported type BRIEOption should have comment or be unexported (golint)
    • Line 2671: warning: exported method BRIEOption.Restore should have comment or be unexported (golint)
    • Line 2711: warning: exported method BRIEStmt.Accept should have comment or be unexported (golint)
    • Line 2727: warning: exported method BRIEStmt.Restore should have comment or be unexported (golint)
    • Line 2804: warning: exported type PurgeImportStmt should have comment or be unexported (golint)
    • Line 2810: warning: exported method PurgeImportStmt.Accept should have comment or be unexported (golint)
    • Line 2816: warning: exported method PurgeImportStmt.Restore should have comment or be unexported (golint)
    • Line 2825: warning: exported const ErrorHandleError should have comment (or a comment on this block) or be unexported (golint)
    • Line 2852: warning: exported type CreateImportStmt should have comment or be unexported (golint)
    • Line 2862: warning: exported method CreateImportStmt.Accept should have comment or be unexported (golint)
    • Line 2868: warning: exported method CreateImportStmt.Restore should have comment or be unexported (golint)
    • Line 2921: warning: exported type StopImportStmt should have comment or be unexported (golint)
    • Line 2928: warning: exported method StopImportStmt.Accept should have comment or be unexported (golint)
    • Line 2934: warning: exported method StopImportStmt.Restore should have comment or be unexported (golint)
    • Line 2943: warning: exported type ResumeImportStmt should have comment or be unexported (golint)
    • Line 2950: warning: exported method ResumeImportStmt.Accept should have comment or be unexported (golint)
    • Line 2956: warning: exported method ResumeImportStmt.Restore should have comment or be unexported (golint)
    • Line 2965: warning: exported type ImportTruncate should have comment or be unexported (golint)
    • Line 2970: warning: exported type AlterImportStmt should have comment or be unexported (golint)
    • Line 2979: warning: exported method AlterImportStmt.Accept should have comment or be unexported (golint)
    • Line 2985: warning: exported method AlterImportStmt.Restore should have comment or be unexported (golint)
    • Line 3021: warning: exported type DropImportStmt should have comment or be unexported (golint)
    • Line 3028: warning: exported method DropImportStmt.Accept should have comment or be unexported (golint)
    • Line 3034: warning: exported method DropImportStmt.Restore should have comment or be unexported (golint)
    • Line 3043: warning: exported type ShowImportStmt should have comment or be unexported (golint)
    • Line 3051: warning: exported method ShowImportStmt.Accept should have comment or be unexported (golint)
    • Line 3057: warning: exported method ShowImportStmt.Restore should have comment or be unexported (golint)
    • Line 3156: warning: exported method HintTable.Restore should have comment or be unexported (golint)
    • Line 3268: warning: exported type BinaryLiteral should have comment or be unexported (golint)
    • parser/ast/functions.go
    • Line 353: warning: exported type FuncCallExprType should have comment or be unexported (golint)
    • Line 356: warning: exported const FuncCallExprTypeKeyword should have comment (or a comment on this block) or be unexported (golint)
    • parser/charset/charset.go
    • Line 25: warning: exported var ErrUnknownCollation should have comment or be unexported (golint)
    • Line 172: warning: exported function GetCollationByName should have comment or be unexported (golint)
    • parser/lexer.go
    • Line 443: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • parser/ast/dml.go
    • Line 317: warning: exported method TableName.Restore should have comment or be unexported (golint)
    • Line 366: warning: comment on exported method IndexHint.Restore should be of the form "Restore ..." (golint)
    • Line 604: warning: exported type SelectLockInfo should have comment or be unexported (golint)
    • Line 927: warning: exported type SampleMethodType should have comment or be unexported (golint)
    • Line 930: warning: exported const SampleMethodTypeNone should have comment (or a comment on this block) or be unexported (golint)
    • Line 936: warning: exported type SampleClauseUnitType should have comment or be unexported (golint)
    • Line 939: warning: exported const SampleClauseUnitTypeDefault should have comment (or a comment on this block) or be unexported (golint)
    • Line 944: warning: exported type TableSample should have comment or be unexported (golint)
    • Line 952: warning: exported method TableSample.Restore should have comment or be unexported (golint)
    • Line 988: warning: exported method TableSample.Accept should have comment or be unexported (golint)
    • Line 1011: warning: exported type SelectStmtKind should have comment or be unexported (golint)
    • Line 1014: warning: exported const SelectStmtKindSelect should have comment (or a comment on this block) or be unexported (golint)
    • Line 1031: warning: exported type CommonTableExpression should have comment or be unexported (golint)
    • Line 1039: warning: exported type WithClause should have comment or be unexported (golint)
    • Line 1095: warning: exported method WithClause.Restore should have comment or be unexported (golint)
    • Line 1125: warning: exported method WithClause.Accept should have comment or be unexported (golint)
    • Line 1484: warning: exported type SetOprType should have comment or be unexported (golint)
    • Line 1487: warning: exported const Union should have comment (or a comment on this block) or be unexported (golint)
    • Line 1634: warning: exported type ColumnNameOrUserVar should have comment or be unexported (golint)
    • Line 1640: warning: exported method ColumnNameOrUserVar.Restore should have comment or be unexported (golint)
    • Line 1654: warning: exported method ColumnNameOrUserVar.Accept should have comment or be unexported (golint)
    • Line 1787: warning: exported const Terminated should have comment (or a comment on this block) or be unexported (golint)
    • Line 1792: warning: exported type FieldItem should have comment or be unexported (golint)
    • Line 2495: warning: exported const ProfileTypeInvalid should have comment (or a comment on this block) or be unexported (golint)
    • Line 2942: warning: exported type SelectIntoType should have comment or be unexported (golint)
    • Line 2945: warning: exported const SelectIntoOutfile should have comment (or a comment on this block) or be unexported (golint)
    • Line 2950: warning: exported type SelectIntoOption should have comment or be unexported (golint)
    • Line 3095: warning: comment on exported type BoundType should be of the form "BoundType ..." (with optional leading article) (golint)
    • Line 3164: warning: exported type SplitRegionStmt should have comment or be unexported (golint)
    • Line 3176: warning: exported type SplitOption should have comment or be unexported (golint)
    • Line 3183: warning: exported type SplitSyntaxOption should have comment or be unexported (golint)
    • Line 3188: warning: exported method SplitRegionStmt.Restore should have comment or be unexported (golint)
    • Line 3225: warning: exported method SplitRegionStmt.Accept should have comment or be unexported (golint)
    • Line 3264: warning: exported method SplitOption.Restore should have comment or be unexported (golint)
    • Line 3312: warning: exported type FulltextSearchModifier should have comment or be unexported (golint)
    • Line 3315: warning: exported const FulltextSearchModifierNaturalLanguageMode should have comment (or a comment on this block) or be unexported (golint)
    • Line 3321: warning: exported method FulltextSearchModifier.IsBooleanMode should have comment or be unexported (golint)
    • Line 3325: warning: exported method FulltextSearchModifier.IsNaturalLanguageMode should have comment or be unexported (golint)
    • Line 3329: warning: exported method FulltextSearchModifier.WithQueryExpansion should have comment or be unexported (golint)
    • Line 3333: warning: comment on exported type TimestampBoundMode should be of the form "TimestampBoundMode ..." (with optional leading article) (golint)
    • Line 3337: warning: exported const TimestampBoundStrong should have comment (or a comment on this block) or be unexported (golint)
    • Line 3344: warning: exported type TimestampReadModes should have comment or be unexported (golint)
    • Line 3347: warning: exported const TimestampReadStrong should have comment (or a comment on this block) or be unexported (golint)
    • Line 3352: warning: exported type TimestampBound should have comment or be unexported (golint)
    • Line 3357: warning: exported type AsOfClause should have comment or be unexported (golint)
    • parser/yy_parser.go
    • Line 71: warning: exported type ParserConfig should have comment or be unexported (golint)
    • Line 126: warning: exported method Parser.SetStrictDoubleTypeCheck should have comment or be unexported (golint)
    • Line 130: warning: exported method Parser.SetParserConfig should have comment or be unexported (golint)
    • parser/ast/expressions.go
    • Line 1336: warning: exported method MatchAgainst.Restore should have comment or be unexported (golint)
    • Line 1365: warning: exported method MatchAgainst.Format should have comment or be unexported (golint)
    • Line 1384: warning: exported method MatchAgainst.Accept should have comment or be unexported (golint)
    • parser/charset/charset_test.go
    • Line 99: warning: don't use underscores in Go names; var charset_num should be charsetNum (golint)
    • Line 104: warning: don't use underscores in Go names; var charset_num should be charsetNum (golint)
    • parser/terror/terror.go
    • Line 54: warning: exported type Error should have comment or be unexported (golint)
    • Line 235: warning: exported var ErrCritical should have comment or be unexported (golint)
    • Line 295: warning: exported function GetErrClass should have comment or be unexported (golint)
    • parser/model/ddl.go
    • Line 87: warning: exported const AddPrimaryKeyStr should have comment (or a comment on this block) or be unexported (golint)
    • parser/model/model.go
    • Line 342: warning: exported type TempTableType should have comment or be unexported (golint)
    • Line 345: warning: exported const TempTableNone should have comment (or a comment on this block) or be unexported (golint)
    • Line 416: warning: exported const TableLockNone should have comment (or a comment on this block) or be unexported (golint)
    • Line 534: warning: exported method TableInfo.GetAutoIncrementColInfo should have comment or be unexported (golint)
    • Line 543: warning: exported method TableInfo.IsAutoIncColUnsigned should have comment or be unexported (golint)
    • Line 650: warning: exported const AlgorithmUndefined should have comment (or a comment on this block) or be unexported (golint)
    • Line 673: warning: exported const SecurityDefiner should have comment (or a comment on this block) or be unexported (golint)
    • Line 693: warning: exported const CheckOptionLocal should have comment (or a comment on this block) or be unexported (golint)
    • Line 719: warning: exported const DefaultSequenceCacheBool should have comment (or a comment on this block) or be unexported (golint)
    • Line 807: warning: exported method PartitionInfo.GetStateByID should have comment or be unexported (golint)
    • Line 816: warning: exported method PartitionInfo.SetStateByID should have comment or be unexported (golint)
    • Line 830: warning: exported method PartitionInfo.GCPartitionStates should have comment or be unexported (golint)
    • Line 850: warning: exported type PartitionState should have comment or be unexported (golint)
    • Line 916: warning: exported const PrimaryKeyTypeDefault should have comment (or a comment on this block) or be unexported (golint)
    • parser/mysql/const.go
    • Line 45: warning: comment on exported const AuthSwitchRequest should be of the form "AuthSwitchRequest ..." (golint)
    • parser/ast/stats.go
    • Line 45: warning: comment on exported type AnalyzeOptionType should be of the form "AnalyzeOptionType ..." (with optional leading article) (golint)

gocyclo84%

Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.

    • parser/lexer.go
    • Line 153: warning: cyclomatic complexity 22 of function (*Scanner).Lex() is high (> 15) (gocyclo)
    • Line 371: warning: cyclomatic complexity 21 of function startWithSlash() is high (> 15) (gocyclo)
    • Line 665: warning: cyclomatic complexity 19 of function startWithNumber() is high (> 15) (gocyclo)
    • parser/types/field_type.go
    • Line 281: warning: cyclomatic complexity 24 of function (*FieldType).RestoreAsCastType() is high (> 15) (gocyclo)
    • Line 224: warning: cyclomatic complexity 19 of function (*FieldType).Restore() is high (> 15) (gocyclo)
    • Line 68: warning: cyclomatic complexity 18 of function (*FieldType).Equal() is high (> 15) (gocyclo)
    • Line 134: warning: cyclomatic complexity 16 of function (*FieldType).CompactStr() is high (> 15) (gocyclo)

ineffassign98%

IneffAssign detects ineffectual assignments in Go code.


license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


misspell98%

Misspell Finds commonly misspelled English words