-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,24 +123,24 @@ WriteToBuf: | |
// keep reading runes into the buffer until we encounter eof or the final delimiter. | ||
for { | ||
r = l.read() | ||
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 | ||
Comment on lines
-126
to
+143
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixes:
|
||
finalDelimiter = true | ||
break WriteToBuf | ||
default: // otherwise, write the rune into the keyword buffer | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Fixes:
Let me know if leaving this in adds any value. Other functions declare an |
||
panicIfNil(l, "lexSymbolState", "lexer") | ||
defer l.current.clear() | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,10 +184,10 @@ func (p *parser) parseComparisonExpr() (expr, error) { | |
case cmpExpr.value == nil && (p.currentToken.Type != stringToken && p.currentToken.Type != numberToken && p.currentToken.Type != symbolToken): | ||
return nil, fmt.Errorf("%s: %w %q in: %q", op, ErrUnexpectedToken, p.currentToken.Value, p.raw) | ||
case cmpExpr.value == nil: | ||
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: | ||
Comment on lines
-187
to
+190
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixes:
|
||
s := p.currentToken.Value | ||
cmpExpr.value = &s | ||
default: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ func fieldValidators(model reflect.Value, opt ...Option) (map[string]validator, | |
model.Kind() == reflect.Pointer && model.Elem().Kind() != reflect.Struct: | ||
return nil, fmt.Errorf("%s: model must be a struct or a pointer to a struct: %w", op, ErrInvalidParameter) | ||
} | ||
var m reflect.Value = model | ||
m := model | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixes:
|
||
if m.Kind() != reflect.Struct { | ||
m = model.Elem() | ||
} | ||
|
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: