-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: exists #223
feat: exists #223
Conversation
internal/linter/linter.go
Outdated
@@ -237,7 +266,7 @@ func (linter *Linter) Run(filesystem fs.FS, debug bool) (err error) { | |||
if debug { | |||
defer func() { | |||
fmt.Printf("-----------------------------\nstatistics\n-----------------------------\n") | |||
fmt.Printf("time: %d ms\n", time.Since(linter.GetStatistics().Start).Milliseconds()) | |||
fmt.Printf("time: %d µs / %d ms\n", time.Since(linter.GetStatistics().Start).Microseconds(), time.Since(linter.GetStatistics().Start).Milliseconds()) |
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.
fmt.Printf("time: %d µs / %d ms\n", time.Since(linter.GetStatistics().Start).Microseconds(), time.Since(linter.GetStatistics().Start).Milliseconds()) | |
fmt.Printf("time: %s\n", time.Since(linter.GetStatistics().Start).Truncate(time.Microsecond).String() |
cmd/ls_lint/main.go
Outdated
} | ||
|
||
log.Printf("%+v", paths) |
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.
Left behind?
var err error | ||
|
||
if value, err = strconv.ParseInt(params[0], 10, 16); err != nil { | ||
return err.(*strconv.NumError).Err |
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.
You should return err
And use errors.As to catch them
Or you use a type assertion check
return err.(*strconv.NumError).Err | |
if nerr, ok := err.(*strconv.NumError); ok { | |
return nerr.Err | |
} | |
return err |
I'm a bit worried by the possible panic here if strconv slightly changes
|
||
func (rule *Exists) GetParameters() []string { | ||
if rule.getMin() == rule.getMax() { | ||
return []string{fmt.Sprintf("%d", rule.getMin())} |
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.
return []string{fmt.Sprintf("%d", rule.getMin())} | |
return []string{fmt.Sprint(rule.getMin())} |
internal/rule/exists.go
Outdated
type Exists struct { | ||
name string | ||
exclusive bool | ||
min int16 |
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.
You are using a limited int, maybe for memory considerate. I'm unsure.
I would have used int.
But if you are looking for performance or memory footprint maybe you could use uint16
min int16 | |
min uint16 |
Thanks @ccoVeille for your review 😄 this pr is in very early wip - i will let you know when its ready to review ❤️ |
I don't think k this would bring support for |
I'm a compulsive reviewer. I know I should respect the "no review on draft" rule. But sometimes (often) maintainers are leaving something in draft for days/weeks, then when it could be ready to be reviewed, they click merge. I would expect maintainers to comply the "wait 24-48h for code to be reviewed" rule 😅 |
close #30
close #201
close #202
close #39
close #32
close #234