go-mnd icon indicating copy to clipboard operation
go-mnd copied to clipboard

Magic number detector for Go.

Results 12 go-mnd issues
Sort by recently updated
recently updated
newest added

Currently when you define a time duration with a number it is considered a magic number. ```go timeToWaitForTask := 30 * time.Second ``` I would think this qualifies as not...

bug

Become curious: should any number (within consition `2

### 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...

The `2` is considered a magic number in the following code. ```golang func center(x, y, w, h int32) (cx int32, cy int32) { cx, cy = w/2+x, h/2+y return }...

enhancement

### Short summary ```go package main import ( "log" "time" ) func main() { log.Println(24 * time.Hour) // reported log.Println(1 * 24 * time.Hour) // not reported } ``` ###...

The Dockerfile hardcodes the use of golang:1.16-alpine. Both golang 1.16 and the alpine version used in this image are unmaintained at this point, with most likely some known unfixed security...

Improves https://github.com/tommy-muehle/go-mnd/commit/9a7adaf33f01691e795de3cf1cd082508ef77e59 by also ignoring `0.`, `1.`

### Short summary Does not work with go 1.20+ ### Steps to reproduce the behavior ``` git clone https://github.com/tommy-muehle/go-mnd go install github.com/tommy-muehle/go-mnd/v2/cmd/mnd@latest mnd ./... ``` ### go-mnd version or commit...

### Description See individual commits for details. ### Motivation and Context ### How Has This Been Tested? Test cases added.

`gomnd` fails to detect the magic numbers `2` and `4` in this code: ```go package main import ( "log" ) func main() { if got, want := 2, 4; got*2...