-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add WSL linter #771
Add WSL linter #771
Conversation
@bombsimon Thanks for the submission. How does your WSL linter differ from https://github.com/ultraware/whitespace which was recently added? |
@tpounds WSL has a bunch more features other than checking leading and trailing whitespaces in blocks. It checks for variable usages and different node types to determine if there should be a newline or not. Please give the WSL readme a quick look to get a better understanding of how WSL works, there should be a lot of examples describing how the linter works. EDIT: You could say that the main purpose of WSL is to add whitespaces to not make the code too tight whereas |
Other than the I can't believe I'm having such ha hard time getting go mod to work, I feel stupid. I've added a tag go: github.com/bombsimon/[email protected]: unexpected status (https://proxy.golang.org/github.com/bombsimon/wsl/@v/v1.0.0.info): 410 Gone Doesn't seem to ba any problem when trying said URL manually: http https://proxy.golang.org/github.com/bombsimon/wsl/@v/v1.0.0.info
HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 64
Alt-Svc: quic=":443"; ma=2592000; v="46,43",h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000
Cache-Control: public, max-age=10800
Content-Length: 50
Content-Type: application/json
Date: Wed, 02 Oct 2019 14:50:55 GMT
Expires: Wed, 02 Oct 2019 17:50:55 GMT
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0
{
"Time": "2019-10-02T13:06:13Z",
"Version": "v1.0.0"
}
Any help or pointers in the right direction is much appreciated! |
.golangci.example.yml
Outdated
@@ -208,6 +208,10 @@ linters-settings: | |||
whitespace: | |||
multi-if: false | |||
|
|||
wsl: | |||
# Skip test files | |||
no-test: false |
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.
- please, don't use negative naming
- please, don't add such duplicating option: any linter can be disabled for tests by
exclude-rules
. It's not performance effective, I agree, but it should be done in a general way for all linters, not per-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.
Sorry about that, I'll remove this since the configuration isn't needed!
Ok so now the Travis pipeline fails with the lint error |
@bombsimon did you update your |
@jirfag Just fixed them with Seems like GolangCI is happy now at least! :) |
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.
@bombsimon Can you add some tests that verify the linter's behavior? This will ensure any regressions will be caught when we upgrade linter versions, add/remove configuration options, and/or tweak internal.
e.g.
https://github.com/golangci/golangci-lint/blob/master/test/testdata/dogsled.go
https://github.com/golangci/golangci-lint/blob/master/test/testdata/errcheck.go
https://github.com/golangci/golangci-lint/blob/master/test/testdata/gocognit.go
Edit: Looks like I missed that you added a single test. What do you think about expanding that to more of the checks?
@tpounds Absolutely, will add more tests! |
@bombsimon Thanks for the additional tests! It looks like CI is still failing due to a https://travis-ci.com/golangci/golangci-lint/jobs/242161917#L699 Can you run |
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.
@bombsimon Nice! Thanks for the contribution! 🚢
@tpounds Thank you for your feedback, help and the merge! What's common practice regarding changes (new errors, new/changed line markings etc)? Should I bump major or minor if/when I do changes to those? It's not really a common interface/API used by other's so I might as well ask. Anything else I should think about now that it's a part of |
@bombsimon In general I think following standard semantic versioning is reasonable. In the case of third party linters it's fairly inconsistent across the board. That said, I think these are general interpretations to the semver guidlines that seem reasonable to me:
/cc @jirfag |
The newest golangci-lint added a new linter `wsl`: golangci/golangci-lint#771 The linting rules it adds don't seem particularly useful to me. Signed-off-by: Steven Danna <[email protected]>
$ git cherry --abbrev -v 0af0999fabfb ee9bf5809ead + abd8436 all: enable Go modules on CI (golangci#753) + 3c9d0fb checkers: recognize //line and //nolint in commentFormatting (golangci#756) + 0b517d7 checkers: extend deprecatedComment patterns (golangci#757) + 09100f6 checkers: use astcast package instead of coerce.go (golangci#758) + 2e9e97f checker: simplify boolExprSimplify (golangci#759) + 575701e make: add go-consistent to CI checks list (golangci#761) + b55f431 checkers: fix unlambda handling of builtins (golangci#763) + 5a7dee3 checker: handle lambdas properly in boolExprSimplify (golangci#765) + 5ce3939 checkers: teach boolExprSimplify a few new tricks (golangci#766) + 04d160f checkers: add new patterns to boolExprSimplify (golangci#768) + 09582e2 make: collect coverprofile separately from goveralls (golangci#769) + d8d0ee4 checkers: recognize NOTE pattern in deprecatedComment (golangci#770) + 12f0f85 Update copyright notice to 2019 (golangci#771) + f54bdb6 checkers: add stringXbytes checker + 170d65c checkers: followup for golangci#773 (golangci#774) + 84e9e83 checkers: make stringXbytes more linear (golangci#775) + a800815 checkers: add Depreacted typo pattern (golangci#776) + 6751be9 checkers: add hexLiterals (golangci#772) + ac61906 checkers: add typeAssertChain checker (golangci#782) + d19dbf1 checkers: add codegenComment checker (golangci#783) + d82b576 checkers: proper pkg/obj check for flagName (golangci#786) + dfcf754 ci: enable integration tests (golangci#787) + 5dafc45 checkers: fix equalFold false positive (golangci#788) + ed5e8e7 checkers: refactor and fix hexLiteral checker (golangci#789) + e704e07 checkers: add argOrder checker (golangci#790) + 34c1dc8 checkers: add Split handling to argOrder checker (golangci#791) + cbe095d checkers: add math.Max and math.Min to dupArg (golangci#792) + c986ee5 checkers: add checkers info fields test (golangci#794) + 66e5832 cmd/makedocs: use lintpack, fix build (golangci#793) + 6bce9d0 cmd/makedocs: add enabled/disabled by default info (golangci#795) + 4adbf9a checkers: simplify flagName (golangci#799) + 07de34a checkers: add octalLiteral checker (golangci#798) + 765907a cmd/makedocs: add checker param docs (golangci#796) + ee9bf58 cmd/makedocs: fix headers formatting (golangci#803)
Added linter WSL. Tests and linter is working with
golangci-lint run
, however I'm experiencing an old issue noted in #255.This is with
golangci-lint
built from this commit (master +08de1f8
) andgoimports
installed withgo get
today (GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports
). No difference with-local
flag or not.