blizzy78 / varnamelen

Go analyzer checking that the length of a variable's name matches its usage scope
MIT License
20 stars 2 forks source link

ignore comment lines #7

Closed vikstrous2 closed 2 years ago

vikstrous2 commented 2 years ago
$ cat main.go
package main

func main() {
        i := 0
        //
        //
        //
        //
        //
        //
        //
        //
        //
        //
        _ = i
}

expected: no error actual:

$ golangci-lint run . --enable varnamelen
main.go:4:2: variable name 'i' is too short for the scope of its usage (varnamelen)
        i := 0
        ^

I confirmed that this reproduces on version 0.5.0

blizzy78 commented 2 years ago

This is working as intended: It reports the usage of a short variable name over a longer span of source lines. The contents of the lines does not matter.