Skip to content

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abhijeetviswa
Copy link

No description provided.

@abhijeetviswa abhijeetviswa requested review from a team as code owners April 14, 2025 12:21
@abhijeetviswa abhijeetviswa marked this pull request as draft April 14, 2025 12:21
Comment on lines -169 to +171
switch {
switch lExpr {
// intentionally not checking raw, since can be an empty string
case lExpr == nil:
case nil:
Copy link
Author

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 {
	^

Comment on lines -126 to +143
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
Copy link
Author

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"
Copy link
Author

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.

Comment on lines -187 to +190
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:
Copy link
Author

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
Copy link
Author

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
	      ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant