-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI and fix existing linter issues
Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
- Loading branch information
Showing
9 changed files
with
301 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: golangci/golangci-lint:v1.44.0 | ||
steps: | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- uses: actions/checkout@v2 | ||
with: | ||
# Required for Codecov report uploading. | ||
fetch-depth: 0 | ||
- run: make install-changelog BIN_PATH=/usr/local/bin | ||
- run: make test-cover-upload test-update-linters lint test-tidy test-changelog | ||
build-docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: docker/build-push-action@v2 | ||
codespell: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: codespell-project/actions-codespell@master | ||
with: | ||
skip: .git,go.sum | ||
check_filenames: true | ||
check_hidden: true | ||
semgrep: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Use dedicated action for nice integration with GitHub. | ||
- uses: returntocorp/semgrep-action@v1 | ||
build-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16 | ||
- uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
args: release --snapshot |
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,113 @@ | ||
output: | ||
sort-results: true | ||
|
||
issues: | ||
exclude-use-default: false | ||
max-same-issues: 0 | ||
max-issues-per-linter: 0 | ||
|
||
linters-settings: | ||
errcheck: | ||
check-type-assertions: true | ||
check-blank: true | ||
gci: | ||
local-prefixes: github.com/invidian/terraform-provider-gpg | ||
godot: | ||
capital: true | ||
gofumpt: | ||
extra-rules: true | ||
govet: | ||
enable-all: true | ||
disable: | ||
- fieldalignment | ||
- shadow | ||
makezero: | ||
always: true | ||
nolintlint: | ||
allow-leading-space: false | ||
require-explanation: true | ||
require-specific: true | ||
wsl: | ||
force-err-cuddling: true | ||
|
||
linters: | ||
disable: | ||
# This linter has been deprecated. | ||
- golint | ||
- interfacer | ||
- maligned | ||
enable: | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- containedctx | ||
- contextcheck | ||
- cyclop | ||
- deadcode | ||
- decorder | ||
- depguard | ||
- dogsled | ||
- dupl | ||
- durationcheck | ||
- errcheck | ||
- errchkjson | ||
- errname | ||
- errorlint | ||
- exhaustive | ||
- exportloopref | ||
- forbidigo | ||
- forcetypeassert | ||
- funlen | ||
- gci | ||
- gochecknoglobals | ||
- gochecknoinits | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- godot | ||
- gofmt | ||
- gofumpt | ||
- goheader | ||
- goimports | ||
- gomnd | ||
- gomoddirectives | ||
- gomodguard | ||
- goprintffuncname | ||
- grouper | ||
- ifshort | ||
- importas | ||
- ineffassign | ||
- lll | ||
- maintidx | ||
- makezero | ||
- misspell | ||
- nakedret | ||
- nestif | ||
- nilerr | ||
- nilnil | ||
- nlreturn | ||
- noctx | ||
- nolintlint | ||
- paralleltest | ||
- prealloc | ||
- predeclared | ||
- promlinter | ||
- revive | ||
- rowserrcheck | ||
- sqlclosecheck | ||
- structcheck | ||
- stylecheck | ||
- tagliatelle | ||
- tenv | ||
- thelper | ||
- tparallel | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- varcheck | ||
- varnamelen | ||
- wastedassign | ||
- whitespace | ||
- wrapcheck | ||
- wsl |
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,25 @@ | ||
rules: | ||
- id: bad-error-wrap-wording | ||
patterns: | ||
- pattern-regex: fmt\.Errorf\(".?([Ff]ailed|[]Uu]nable|[Cc]ould|([Ee]rror)) | ||
message: Word "fail", "failed", "unable", "could not" should not be used when wrapping errors. Use verb in continuous form instead! | ||
languages: [go] | ||
severity: ERROR | ||
- id: printed-messages-must-be-captialized | ||
patterns: | ||
- pattern-regex: (fmt.Print(ln|f)|\bt\.(Error|Fatal|Log)(|f))\("[a-z] | ||
message: Printed messages must be capitalized. | ||
languages: [go] | ||
severity: ERROR | ||
- id: strings-must-be-quoted-using-q | ||
patterns: | ||
- pattern-regex: "'%s'" | ||
message: When formatting, strings must be quoted using %q instead of e.g. '%s'. | ||
languages: [go] | ||
severity: ERROR | ||
- id: error-wrapping-must-be-preceded-by-space | ||
patterns: | ||
- pattern-regex: '[^ ]%w' | ||
message: When wrapping errors, %w must be preceded by space. | ||
languages: [go] | ||
severity: ERROR |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.