Skip to content
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

Merged
merged 13 commits into from
Jul 11, 2024
Merged

feat: exists #223

merged 13 commits into from
Jul 11, 2024

Conversation

loeffel-io
Copy link
Owner

@loeffel-io loeffel-io commented Apr 23, 2024

close #30
close #201
close #202
close #39
close #32
close #234

@loeffel-io loeffel-io self-assigned this Apr 23, 2024
@@ -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())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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()

}

log.Printf("%+v", paths)

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

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

Suggested change
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())}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return []string{fmt.Sprintf("%d", rule.getMin())}
return []string{fmt.Sprint(rule.getMin())}

type Exists struct {
name string
exclusive bool
min int16

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

Suggested change
min int16
min uint16

@loeffel-io
Copy link
Owner Author

Thanks @ccoVeille for your review 😄 this pr is in very early wip - i will let you know when its ready to review ❤️

@loeffel-io loeffel-io mentioned this pull request Jul 11, 2024
@ccoVeille
Copy link

I don't think k this would bring support for

@ccoVeille
Copy link

ccoVeille commented Jul 11, 2024

Thanks @ccoVeille for your review 😄 this pr is in very early wip

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 😅

@loeffel-io loeffel-io marked this pull request as ready for review July 11, 2024 16:45
@loeffel-io loeffel-io merged commit 888a537 into master Jul 11, 2024
0 of 3 checks passed
@loeffel-io loeffel-io deleted the feature/loeffel-io/#30-exists branch July 11, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants