-
Notifications
You must be signed in to change notification settings - Fork 12
add ci linting and fix existing lint errors #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
switch { | ||
switch lExpr { | ||
// intentionally not checking raw, since can be an empty string | ||
case lExpr == nil: | ||
case nil: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes:
expr.go:169:2: QF1002: could use tagged switch on lExpr (staticcheck)
switch {
^
switch { | ||
case r == eof: | ||
switch r { | ||
case eof: | ||
break WriteToBuf | ||
case r == backslash: | ||
case backslash: | ||
nextR := l.read() | ||
switch { | ||
case nextR == eof: | ||
switch nextR { | ||
case eof: | ||
tokenBuf.WriteRune(r) | ||
return nil, fmt.Errorf("%s: %w in %q", op, ErrInvalidTrailingBackslash, tokenBuf.String()) | ||
case nextR == backslash: | ||
case backslash: | ||
tokenBuf.WriteRune(nextR) | ||
case nextR == delimiter: | ||
case delimiter: | ||
tokenBuf.WriteRune(nextR) | ||
default: | ||
tokenBuf.WriteRune(r) | ||
tokenBuf.WriteRune(nextR) | ||
} | ||
case r == delimiter: // end of the quoted string we're scanning | ||
case delimiter: // end of the quoted string we're scanning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes:
lex.go:126:3: QF1002: could use tagged switch on r (staticcheck)
switch {
^
lex.go:131:4: QF1002: could use tagged switch on nextR (staticcheck)
switch {
^
@@ -159,7 +159,6 @@ WriteToBuf: | |||
// lexSymbolState scans for strings and can emit the following tokens: | |||
// orToken, andToken, containsToken | |||
func lexSymbolState(l *lexer) (lexStateFunc, error) { | |||
const op = "mql.lexSymbolState" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes:
lex.go:162:8: const op is unused (unused)
const op = "mql.lexSymbolState"
^
Let me know if leaving this in adds any value. Other functions declare an op
to be used in lexing error strings.
switch { | ||
case p.currentToken.Type == symbolToken: | ||
switch p.currentToken.Type { | ||
case symbolToken: | ||
return nil, fmt.Errorf("%s: %w %s == %s (expected: %s or %s) in %q", op, ErrInvalidComparisonValueType, p.currentToken.Type, p.currentToken.Value, stringToken, numberToken, p.raw) | ||
case p.currentToken.Type == stringToken, p.currentToken.Type == numberToken: | ||
case stringToken, numberToken: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes:
parser.go:187:4: QF1002: could use tagged switch on p.currentToken.Type (staticcheck)
switch {
^
var m reflect.Value = model | ||
m := model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes:
validate.go:35:8: ST1023: should omit type reflect.Value from declaration; it will be inferred from the right-hand side (staticcheck)
var m reflect.Value = model
^
No description provided.