tommy-muehle
Repos
49
Followers
95
Following
138

Magic number detector for Go.

156
14

Fast linters Runner for Go

11569
1089

Events

Brew formula update for go-mnd version v2.5.1

Created at 1 month ago
create tag
tommy-muehle create tag v2.5.1
Created at 1 month ago
closed issue
Duplicated code

Short summary

There exists many duplicated code, why not refactoring?It seems that in each checker, the desitination is always a BasicLit, and before find a BasicLit, there are codes duplicated.

Created at 1 month ago
issue comment
Duplicated code

Hi @ChenhuaYang,

you're totally right!

This linter is mainly the result of trying out the go/analysis API some years ago. Since then I had multiple times in the past the idea/wish to rewrite it completely in a v2 and use an analyser like in gosec or similar tools.

But to be honest this project has not my main focus. So don't get me wrong. I will of course fix bugs and false-positives when they pop up. But I've no time for a complete rewrite.

Cheers, Tommy

Created at 1 month ago
closed issue
time duration not considered a magic number

Currently when you define a time duration with a number it is considered a magic number.

timeToWaitForTask := 30 * time.Second

I would think this qualifies as not being a magic number since it is clear what you are using the number for. It also reads better than the desired state which would be this.

timeInSecondsToWait := 30
timetoWaitForTask := timeInSecondsToWait * time.Second
Created at 1 month ago
issue comment
time duration not considered a magic number

Hi there,

in general I share totally the same point that @bflad brought up. But on the other side I can also understand that, especially in smaller projects, time related findings looking weird because it's very common to write timeouts inline. So I tried the last 3 evenings to filter them out via a new flag "time-sensitive" yes/no.

But unfortunately it's harder than I thought in the beginning and I ended up with some partly very complex code that also shows some false-positives during my tests and even more bad with an operation checker who also jumps in for assignments.

So maybe it's me and the lack of time but I'll break up here to prevent some strange results in the future.

Created at 1 month ago
Created at 1 month ago
closed issue
`strconv.FormatInt` or `strconv.FormatUint` and magic numbers ?

Become curious: should any number (within consition 2 <= n <= 36) be considered as magic number if used in strconv.FormatInt or strconv.FormatUint ?

Created at 1 month ago

Ignore some strconv functions by default, fixes #27

Created at 1 month ago
Created at 1 month ago
Created at 1 month ago
started
Created at 1 month ago
started
Created at 2 months ago
started
Created at 2 months ago
started
Created at 2 months ago
Created at 2 months ago
Created at 2 months ago