mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tests: integrate "github.com/mgechev/revive" to fmt tests
https://github.com/mgechev/revive Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
104b6a3424
commit
1c04820026
13
test
13
test
@ -511,6 +511,18 @@ function staticcheck_pass {
|
||||
fi
|
||||
}
|
||||
|
||||
function revive_pass {
|
||||
if which revive >/dev/null; then
|
||||
reviveResult=$(revive -config ./tests/revive.toml -exclude "vendor/..." ./... 2>&1 || true)
|
||||
if [ -n "${reviveResult}" ]; then
|
||||
echo -e "revive checking failed:\\n${reviveResult}"
|
||||
exit 255
|
||||
fi
|
||||
else
|
||||
echo "Skipping revive..."
|
||||
fi
|
||||
}
|
||||
|
||||
function unconvert_pass {
|
||||
if which unconvert >/dev/null; then
|
||||
unconvertResult=$(unconvert -v "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true)
|
||||
@ -615,6 +627,7 @@ function fmt_pass {
|
||||
unused \
|
||||
unparam \
|
||||
staticcheck \
|
||||
revive \
|
||||
unconvert \
|
||||
ineffassign \
|
||||
nakedret \
|
||||
|
@ -46,6 +46,7 @@ ADD ./scripts/install-marker.sh /tmp/install-marker.sh
|
||||
|
||||
RUN go get -v -u -tags spell github.com/chzchzchz/goword \
|
||||
&& go get -v -u github.com/coreos/license-bill-of-materials \
|
||||
&& go get -v -u github.com/mgechev/revive \
|
||||
&& go get -v -u github.com/mdempsky/unconvert \
|
||||
&& go get -v -u mvdan.cc/unparam \
|
||||
&& go get -v -u honnef.co/go/tools/cmd/gosimple \
|
||||
|
38
tests/revive.toml
Normal file
38
tests/revive.toml
Normal file
@ -0,0 +1,38 @@
|
||||
ignoreGeneratedHeader = false
|
||||
severity = "warning"
|
||||
confidence = 0.8
|
||||
errorCode = 0
|
||||
warningCode = 0
|
||||
|
||||
[rule.blank-imports]
|
||||
[rule.context-as-argument]
|
||||
[rule.dot-imports]
|
||||
[rule.error-return]
|
||||
[rule.error-naming]
|
||||
[rule.if-return]
|
||||
[rule.increment-decrement]
|
||||
[rule.var-declaration]
|
||||
[rule.package-comments]
|
||||
[rule.range]
|
||||
[rule.receiver-naming]
|
||||
[rule.time-naming]
|
||||
[rule.indent-error-flow]
|
||||
[rule.errorf]
|
||||
|
||||
|
||||
# TODO: enable following
|
||||
|
||||
# grpcproxy context.WithValue(ctx, rpctypes.TokenFieldNameGRPC, token)
|
||||
# [rule.context-keys-type]
|
||||
|
||||
# punctuation in error value
|
||||
# [rule.error-strings]
|
||||
|
||||
# underscore variables
|
||||
# [rule.var-naming]
|
||||
|
||||
# godoc
|
||||
# [rule.exported]
|
||||
|
||||
# return unexported type
|
||||
# [rule.unexported-return]
|
Loading…
x
Reference in New Issue
Block a user