-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Basic Linter #9005
Introduce Basic Linter #9005
Conversation
Issues linked to changelog: |
…into sam/introduce-linter
…into sam/introduce-linter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is AWESOME!
Two other possible rules:
- usage of deprecated
io/ioutil
- Async assertions without defined timeout and interval
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 this is excellent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Another potential rule to consider -- instantiation of Ginkgo control blocks ( We try to do this in the happypath tests which leads to misleading results https://github.com/solo-io/gloo/blob/dd567e83fc8137ae6a0ae5312b9a765348ef45ee/test/e2e/happypath_test.go#L88-L90 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼 🚀
trigger bulldozer |
Description
Introduce a linter, inspired by https://github.com/solo-io/gloo-mesh-enterprise/blob/main/.golangci.yaml
Context
Introducing a linter will always be a large lift, that won't be completed in a single PR. I aim to introduce the structure of the lint logic, with minimal requirements. Hopefully this will make it easier for future devs to add incremental enhancements which overall improve the health of the codebase.
In this PR I only introduce the ginkgo linter, and then I don't even make tests required as part of CI. In essence, this does nothing. However I do it for the following reasons:
make analyze
locally and fix tests lint issuesAuto-Fix Challenges
The
ginkgolinter
has auto-fix logic:However, when I run that locally, I get a panic:
Solution
I've taken the following approach to get around this:
ginkgolinter -fix ./...
-fix
nunnatsa/ginkgolinter#124 to track this bugSolution Update
Both issues that I had hit with the Ginkgo linter (nunnatsa/ginkgolinter#124 (comment)) have been fixed in a recent release.
Interesting decisions
Testing steps
make analyze
with tests enabled, and fixed a number of lint issues in testsmake analyze
with tests disabled, and confirmed that no errors existedNotes for reviewers
Next Steps
I intend to follow up this PR with more fixes for tests, and see if we can enable test linting in CI
Checklist: