Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add linter to CI (allow CI to continue of fail, since currently a lot of errors and warnings arise) Added separate linter YAML setting for CI. Add CI step to check `go generate` are up to date. Added sequence ordering to make sure lint and go gen run before tests, which runs before build. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
- Loading branch information
Showing
3 changed files
with
187 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
run: | ||
timeout: 2m | ||
|
||
issues: | ||
max-same-issues: 5 | ||
max-issues-per-linter: 100 | ||
|
||
linters: | ||
enable: | ||
# style | ||
- containedctx # struct contains a context | ||
- goconst # strings that should be constants | ||
- misspell | ||
- predeclared # shadows predeclared Go identifier | ||
- stylecheck | ||
- unconvert # unnecessary conversions | ||
|
||
# bugs and others... | ||
- contextcheck # function uses a non-inherited context | ||
- dupl # code clone | ||
- errname # erorrs are named correctly | ||
- errorlint # errors not wrapped for 1.13 | ||
- exhaustive # check exhaustiveness of enum switch statements | ||
- exportloopref # using loop variable pointer | ||
- gofmt | ||
- gosec # security | ||
- nestif # deeply nested ifs | ||
- nilerr # returns nil even with non-nil error | ||
- prealloc # slices that can be pre-allocated | ||
- revive # golint replacement | ||
- structcheck # unused struct fields | ||
- unparam # unused function params | ||
|
||
linters-settings: | ||
govet: | ||
enable-all: true | ||
check-shadowing: true | ||
settings: | ||
shadow: | ||
strict: false | ||
stylecheck: | ||
checks: | ||
- all | ||
initialisms: | ||
# defaults (https://staticcheck.io/docs/configuration/options/#initialisms) | ||
- ACL | ||
- API | ||
- ASCII | ||
- CPU | ||
- CSS | ||
- DNS | ||
- EOF | ||
- GUID | ||
- HTML | ||
- HTTP | ||
- HTTPS | ||
- ID | ||
- IP | ||
- JSON | ||
- QPS | ||
- RAM | ||
- RPC | ||
- SLA | ||
- SMTP | ||
- SQL | ||
- SSH | ||
- TCP | ||
- TLS | ||
- TTL | ||
- UDP | ||
- UI | ||
- GID | ||
- UID | ||
- UUID | ||
- URI | ||
- URL | ||
- UTF8 | ||
- VM | ||
- XML | ||
- XMPP | ||
- XSRF | ||
- XSS | ||
- SIP | ||
- RTP | ||
- AMQP | ||
- DB | ||
- TS | ||
|
||
# specific | ||
- CID | ||
- CRI | ||
- CTRD | ||
- ETW | ||
- GCS | ||
- GMSA | ||
- HCS | ||
- IO | ||
- LCOW | ||
- LPAC | ||
- LTSC | ||
- MMIO | ||
- OCI | ||
- RX | ||
- TX | ||
- VHD | ||
- VHDX | ||
- VMID | ||
- VPCI | ||
- WCOW |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"go.lintTool": "golangci-lint", | ||
"go.lintOnSave": "package", | ||
"go.lintFlags": [ | ||
"--fix", | ||
"--verbose", | ||
], | ||
} |