-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add golangci-lint, yamlllint and codespell
Signed-off-by: lianghao208 <roylizard3@gmail.com>
- Loading branch information
1 parent
27606e4
commit b7662a8
Showing
10 changed files
with
195 additions
and
4 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,2 @@ | ||
keypair | ||
keypairs |
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,11 @@ | ||
.git | ||
*.png | ||
*.woff | ||
*.woff2 | ||
*.eot | ||
*.ttf | ||
*.jpg | ||
*.ico | ||
*.svg | ||
go.mod | ||
go.sum |
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,33 @@ | ||
run: | ||
deadline: 10m | ||
|
||
linters: | ||
enable: | ||
- bodyclose | ||
- gofmt | ||
- goimports | ||
- revive | ||
- gosec | ||
- misspell | ||
- unconvert | ||
- unparam | ||
- goheader | ||
- gocritic | ||
|
||
linters-settings: | ||
gofmt: | ||
simplify: true | ||
unparam: | ||
check-exported: false | ||
|
||
issues: | ||
exclude-rules: | ||
- path: zz_generated | ||
linters: | ||
- goimports | ||
- linters: | ||
- staticcheck | ||
text: "SA1019:" | ||
- path: test/e2e | ||
linters: | ||
- bodyclose |
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,49 @@ | ||
--- | ||
|
||
rules: | ||
braces: | ||
min-spaces-inside: 0 | ||
max-spaces-inside: 0 | ||
min-spaces-inside-empty: -1 | ||
max-spaces-inside-empty: -1 | ||
brackets: | ||
min-spaces-inside: 0 | ||
max-spaces-inside: 1 | ||
min-spaces-inside-empty: -1 | ||
max-spaces-inside-empty: -1 | ||
colons: | ||
max-spaces-before: 0 | ||
max-spaces-after: 1 | ||
commas: | ||
max-spaces-before: 1 | ||
min-spaces-after: 1 | ||
max-spaces-after: 1 | ||
comments: | ||
level: warning | ||
require-starting-space: true | ||
min-spaces-from-content: 2 | ||
comments-indentation: | ||
level: warning | ||
document-end: disable | ||
document-start: disable | ||
empty-lines: | ||
max: 2 | ||
max-start: 0 | ||
max-end: 1 | ||
empty-values: | ||
forbid-in-block-mappings: false | ||
forbid-in-flow-mappings: true | ||
hyphens: | ||
max-spaces-after: 1 | ||
indentation: | ||
spaces: 2 | ||
indent-sequences: whatever | ||
check-multi-line-strings: false | ||
key-duplicates: enable | ||
key-ordering: disable | ||
new-line-at-end-of-file: enable | ||
new-lines: | ||
type: unix | ||
trailing-spaces: disable | ||
truthy: | ||
level: warning |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#! /usr/bin/env bash | ||
|
||
readonly PROGNAME="codespell" | ||
|
||
if command -v ${PROGNAME} >/dev/null; then | ||
exec ${PROGNAME} "$@" | ||
fi | ||
|
||
if command -v docker >/dev/null; then | ||
exec docker run --rm -i \ | ||
-v $(pwd):/workdir \ | ||
lianghao208/codespell:v2.1.0 "$@" | ||
fi | ||
|
||
cat <<EOF | ||
Unable to run codespell. Please check installation instructions: | ||
https://github.com/codespell-project/codespell#installation | ||
EOF | ||
|
||
exit 69 # EX_UNAVAILABLE |
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,22 @@ | ||
#! /usr/bin/env bash | ||
|
||
readonly PROGNAME="golangci-lint" | ||
|
||
if command -v ${PROGNAME} >/dev/null; then | ||
exec ${PROGNAME} "$@" | ||
fi | ||
|
||
if command -v docker >/dev/null; then | ||
exec docker run \ | ||
--rm \ | ||
--volume $(pwd):/app \ | ||
--workdir /app \ | ||
golangci/golangci-lint:v1.46.2 ${PROGNAME} "$@" | ||
fi | ||
|
||
cat <<EOF | ||
Unable to run golang-ci. Please check installation instructions: | ||
https://github.com/golangci/golangci-lint#install | ||
EOF | ||
|
||
exit 69 # EX_UNAVAILABLE |
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,20 @@ | ||
#! /usr/bin/env bash | ||
|
||
readonly PROGNAME="yamllint" | ||
|
||
if command -v ${PROGNAME} >/dev/null; then | ||
exec ${PROGNAME} "$@" | ||
fi | ||
|
||
if command -v docker >/dev/null; then | ||
exec docker run --rm -i \ | ||
-v $(pwd):/data \ | ||
giantswarm/yamllint:1.25 "$@" | ||
fi | ||
|
||
cat <<EOF | ||
Unable to run yamllint. Please check installation instructions: | ||
https://github.com/adrienverge/yamllint#installation | ||
EOF | ||
|
||
exit 69 # EX_UNAVAILABLE |