While investigating #3227, I tried to run the lint Make task locally (both on macOS and Ubuntu), and the task fails.
make lint ─╯
Running Go linter ...
Running YAML linter ...
Unable to run codespell. Please check installation instructions:
https://github.com/codespell-project/codespell#installation
make: *** [Makefile:158: lint-codespell] Error 69
...
Here is a summary of the 26 linter warnings remaining:
- 10 - comment on exported ... should be of the form
- 9 - don't use underscores in Go names
- 7 - package comment should be of the form ...
I'm happy to take a stab at fixing these 26 warnings. Just don't think that this is the proper issue to perform that work under.
I'm very happy for you to tackle these warnings :)
The approach I recommend is to keep this PR open, and post a separate PR to fix up the linter warnings that you find. Once the lint runs cleanly with the new config, then we can land this.
Also, another issue is that the Make
linttarget does not seem to work -make lint Running Go linter ... Running YAML linter ... Unable to run codespell. Please check installation instructions: https://github.com/codespell-project/codespell#installation make: *** [Makefile:158: lint-codespell] Error 69If you agree that is another issue, I'm happy to create that issue and look into it as well.
Yep I agree with this. All the linters should work locally.
_Originally posted by @jpeach in https://github.com/projectcontour/contour/issues/3271#issuecomment-769493837_
You need the codespell bits locally is what that's telling you. The PR build works because there's a Github action with those embedded.
@stevesloka When I first started looking into the linter warnings last week, I enlisted the eyes of a co-worker to review what I was doing and to help figure out why the linter would be failing. We were able to find an error stating that the --ignore-words argument was illegal. Unfortunately, I don't seem to have recorded the exact error in my notes, and I am now unable to re-create that problem which led me to believe that there is a problem with this task, and hence create this issue.
So on a second look, I was able to get the lint task to run on both macOS and Ubuntu, with different results.
After running a brew install codespell on macOS, I did get a successful run -
$> make lint
Running Go linter ...
Running YAML linter ...
$> echo $?
0
On Ubuntu, I am getting an error. I'll double check my install/environment over the weekend and give it another look.
$> make lint
Running Go linter ...
Running YAML linter ...
/usr/lib/python3.8/codecs.py:905: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
file = builtins.open(filename, mode, buffering)
./.golangci.yml:25: clas ==> class | disabled because of name clash in c++
./SECURITY.md:36: Mitre ==> Miter
./SECURITY.md:36: mitre ==> miter
./pkg/certs/certgen.go:62: uint ==> unit | disabled due to being a data type
./pkg/certs/certgen.go:266: uint ==> unit | disabled due to being a data type
./pkg/certs/certgen.go:266: uint ==> unit | disabled due to being a data type
./pkg/certs/certgen.go:266: uint ==> unit | disabled due to being a data type
./internal/xdscache/v3/endpointstranslator_test.go:827: clas ==> class | disabled because of name clash in c++
./internal/xdscache/v3/endpointstranslator_test.go:829: clas ==> class | disabled because of name clash in c++
./internal/envoy/v3/route.go:125: iff ==> if | disabled due to valid mathematical concept
./design/tls-backend-verification.md:67: CAs ==> case
./design/httpproxy-status-conditions.md:33: Tim ==> Time, tim | disabled due to being a person's name
./design/tls-client-verification.md:61: CAs ==> case
./cmd/contour/certgen.go:78: uint ==> unit | disabled due to being a data type
./cmd/contour/servecontext.go:42: uint ==> unit | disabled due to being a data type
make: *** [Makefile:158: lint-codespell] Error 15
$> echo $?
2
I took a fresh look at the lint tasks and determined that my problems stemmed from having codespell 1.16 on my Linux workstation. After updating codespell to version 2.0, the lint task completed successfully!
I'll put together an addition to the contributing docs regarding the need for version 2.0 or greater.
I opened and completed Issue #3360 which added documentation to install a later version of codespell. That resolves this issue for me.
Most helpful comment
I took a fresh look at the lint tasks and determined that my problems stemmed from having
codespell1.16 on my Linux workstation. After updatingcodespellto version 2.0, the lint task completed successfully!I'll put together an addition to the contributing docs regarding the need for version 2.0 or greater.