sayboras bd2921655a Added go-mnd linter (#842)
* Initial commit

* Fixed goimports

* Update pkg/golinters/mnd.go

Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>

* Run goimports

* Update pkg/golinters/mnd.go

Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>

* Add prefix for goimport local

* Run make README.md

* Incorporate review comments
Add test cases

* Update readme

* Update the description

* Removed subpath in local-prefixes

* Update readme
2019-11-15 19:08:43 -05:00

13 lines
224 B
Go

package checks
import (
"go/ast"
"go/token"
)
const reportMsg = "Magic number: %v, in <%s> detected"
func isMagicNumber(l *ast.BasicLit) bool {
return (l.Kind == token.FLOAT || l.Kind == token.INT) && l.Value != "0"
}