feat: exists - #223
Conversation
| 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.
| 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() |
| filesystem = mapFilesystem | ||
| } | ||
|
|
||
| log.Printf("%+v", paths) |
| 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.
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.
| return []string{fmt.Sprintf("%d", rule.getMin())} | |
| return []string{fmt.Sprint(rule.getMin())} |
| type Exists struct { | ||
| name string | ||
| exclusive bool | ||
| min int16 |
There was a problem hiding this comment.
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