-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
tools: linters we could add #1372
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1372 +/- ##
===========================================
- Coverage 62.81% 61.88% -0.93%
===========================================
Files 109 103 -6
Lines 6016 5864 -152
===========================================
- Hits 3779 3629 -150
+ Misses 2020 2018 -2
Partials 217 217 |
For some reason, all the output doesn't show on circle CI. So check out the following ghost bin for the sample error: https://ghostbin.com/paste/cpdaz |
Can we ensure that local output and CI output are the same and add a |
Will do. I'll add a make test_lint command to this PR, but I'd rather we decide which linters to use first before making the command. |
That's fine - but ideally we avoid special-casing the CircleCI config; CircleCI should just run |
I'm all for maximal metalinting 👍 |
|
I'm conflicted on whether or not
It gave a couple of useful points, e.g. |
Looks like structcheck doesn't do what we want. It only checks at the module level, not at the whole project level. This may be something that can be fixed though. I'm going to remove it from here for now, until a better tool / structcheck has been forked. I'll remove deadcode too, we can always add it back if we like its output. |
Note, I've disabled errcheck output on the client directories. This was because the errors there don't really contribute to failing fast / aren't that helpful. (i.e. not checking errors on writing the http responses) |
@ValarDragon As mentioned on our call two days ago - we should close this PR and open an issue which contains all the linters (and discussions) - then we should open up individual PRs for each linter being added which simultaneously adds the linter as well as fixes all bugs which the linter pointed out
|
This PR adds several linters we can potentially use. Please comment with your thoughts on using the following linters! I've left their errors in the linting step, so we can evaluate how useful they are.
Also take a look here if theres any more linters you think we should run on circle ci: https://github.com/alecthomas/gometalinter
deadcode - checks for deadcodemaligned - closes Reorder variables structs to optimize memory #1257, I've switched this to my own fork, which prints out how to change the structs.goconst - Finds repeated strings that could be replaced by a constant.structcheck - look for unused struct fieldstools: Add a linter to check for struct fields that aren't used anywhere in the project #1408Closes #1084
I've left the errors in linting to make it easier to judge whether its something we want to use. Once we decide which ones to keep, I'll update the make file and make test_lint accordingly.
Changelog also needs to be updated, will do once we decide on which linters to use.
Also remember, if we agree with a linter in most places, but not in a couple, we should still use it, and just add nolint in the places we disagree. (nolint can be extended to cover an entire file iirc too)