tinkerbell / lint-install

Consistently install reasonable linter rules for open-source projects
Apache License 2.0
6 stars 7 forks source link

Exclude forcetypeassert and noctx checks from test files #17

Closed tstromberg closed 2 years ago

tstromberg commented 2 years ago

noctx and forcetypeassert checks mostly serve to catch unexpected production runtime faults, and are raise lint issues that aren't necessary to resolve in tests. For instance:

http-server/http_server_test.go:276:31: should rewrite http.NewRequestWithContext or add (*Request).WithContext (noctx)
            req, err := http.NewRequest("GET", test.url, nil)

and:

packet_test.go:372:3: type assertion must be checked (forcetypeassert)
        px := p.(*packetOACK)
        ^

Rather than generate extra work for coders and reviewers, I think we should turn these checks off for tests where they are unlikely to ever generate unexpected behavior.