-
Notifications
You must be signed in to change notification settings - Fork 462
add golangci-lint #600
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 golangci-lint #600
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| --- | ||
| run: | ||
| concurrency: 6 | ||
| deadline: 5m | ||
| skip-files: | ||
| - ".*_test\\.go" | ||
| - "lib/.*" | ||
| linters: | ||
| disable-all: true | ||
| enable: | ||
| - deadcode | ||
| - depguard | ||
| #- dupl | ||
| #- gochecknoinits | ||
| - goconst | ||
| - gocritic | ||
| - gofmt | ||
| - goimports | ||
| - golint | ||
| - gosec | ||
| - govet | ||
| - ineffassign | ||
| #- interfacer | ||
| #- maligned | ||
| - misspell | ||
| #- prealloc | ||
| #- scopelint | ||
| - staticcheck | ||
| - structcheck | ||
| - typecheck | ||
| - unconvert | ||
| - unparam | ||
| - varcheck | ||
| #- errcheck | ||
| #- gochecknoglobals | ||
| - gocyclo | ||
| #- lll | ||
| #- nakedret | ||
| linters-settings: | ||
| gocritic: | ||
| enabled-checks: | ||
| # Diagnostic | ||
| - argOrder | ||
| - badCond | ||
| - caseOrder | ||
| - codegenComment | ||
| - commentedOutCode | ||
| - deprecatedComment | ||
| - dupArg | ||
| - dupBranchBody | ||
| - dupCase | ||
| - dupSubExpr | ||
| - exitAfterDefer | ||
| - flagDeref | ||
| - flagName | ||
| - nilValReturn | ||
| - offBy1 | ||
| - weakCond | ||
| #- appendAssign | ||
| - octalLiteral | ||
| - sloppyReassign | ||
|
|
||
| # Performance | ||
| - equalFold | ||
| #- hugeParam | ||
| - indexAlloc | ||
| - rangeExprCopy | ||
| #- rangeValCopy | ||
| - appendCombine | ||
|
|
||
| # Style | ||
| - assignOp | ||
| - boolExprSimplify | ||
| - captLocal | ||
| - commentFormatting | ||
| - commentedOutImport | ||
| - defaultCaseOrder | ||
| - docStub | ||
| - elseif | ||
| - emptyFallthrough | ||
| - emptyStringTest | ||
| - hexLiteral | ||
| #- ifElseChain | ||
| - methodExprCall | ||
| - regexpMust | ||
| - singleCaseSwitch | ||
| - sloppyLen | ||
| - stringXbytes | ||
| - switchTrue | ||
| - typeAssertChain | ||
| - typeSwitchVar | ||
| - underef | ||
| - unlabelStmt | ||
| - unlambda | ||
| - unslice | ||
| - valSwap | ||
| - yodaStyleExpr | ||
| - wrapperFunc | ||
|
|
||
| # Opinionated | ||
| - initClause | ||
| - nestingReduce | ||
| - ptrToRefParam | ||
| - typeUnparen | ||
| - unnecessaryBlock | ||
| #- builtinShadow | ||
| #- importShadow | ||
| - paramTypeCombine | ||
| #- unnamedResult | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,8 @@ update: | |
| # make verify | ||
| verify: | ||
| @which go-bindata 2> /dev/null >&1 || { echo "go-bindata must be installed to verify generated code"; exit 1; } | ||
| @which golangci-lint 2> /dev/null >&1 || { echo "golangci-lint must be installed to lint code"; exit 1; } | ||
|
||
| golangci-lint run | ||
| hack/verify-codegen.sh | ||
| hack/verify-generated-bindata.sh | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,9 +18,6 @@ var ( | |
| Short: "Run Machine Config Operator", | ||
| Long: "", | ||
| } | ||
|
|
||
| rootOpts struct { | ||
| } | ||
| ) | ||
|
|
||
| func init() { | ||
|
|
||
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.
we definitely want to exclude unit test files from linting? Just double checking.
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.
yep, but as with the other "ignored" linters in this file, we might want, at some point, remove this and fix everything. Right now we need to get this in and fix code (not tests) to have this run and check on every PR w/o asking ppl to gofmt as you noticed.
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.
ok sounds good