This repository was archived by the owner on Aug 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1034 from grafana/dev-qa
better qa scripts
- Loading branch information
Showing
23 changed files
with
2,228 additions
and
25 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
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
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 @@ | ||
#!/bin/bash | ||
|
||
# finds unchecked errors | ||
|
||
# find the dir we exist within... | ||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
# and cd into root project dir | ||
echo $DIR | ||
cd ${DIR}/../.. | ||
go get -u github.com/kisielk/errcheck | ||
errcheck ./... |
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 @@ | ||
#!/bin/bash | ||
|
||
# finds all kinds of lint | ||
|
||
# find the dir we exist within... | ||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
# and cd into root project dir | ||
echo $DIR | ||
cd ${DIR}/../.. | ||
go get -u golang.org/x/lint/golint | ||
golint $(go list ./... | grep -v vendor) |
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,10 @@ | ||
#!/bin/bash | ||
|
||
# runs all of the "go vet" checks | ||
|
||
# find the dir we exist within... | ||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
# and cd into root project dir | ||
cd ${DIR}/../.. | ||
|
||
go vet ./... |
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 |
---|---|---|
@@ -1,23 +1,67 @@ | ||
#!/bin/bash | ||
|
||
# this script checks whether we have gitignore rules for all binaries we compile | ||
|
||
# Find the directory we exist within | ||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
cd $DIR/../../cmd | ||
file=../.gitignore | ||
|
||
# NOTE: known limitation: does not clean up stale gitignore rules | ||
|
||
declare -a missing | ||
declare -a malformed | ||
declare -a extraneous | ||
|
||
ret=0 | ||
|
||
for bin in *; do | ||
rule="/cmd/$bin/$bin" | ||
grep -q "^$rule$" $file || missing=("${missing[@]}" "$rule") | ||
done | ||
|
||
while read a b c; do | ||
if [ -n "$c" ]; then | ||
malformed=("${malformed[@]}" "/cmd/$a/$b/$c...") | ||
elif [ "$a" != "$b" ]; then | ||
malformed=("${malformed[@]}" "/cmd/$a/$b") | ||
elif [ ! -d "$a" ]; then | ||
extraneous=("${extraneous[@]}" "/cmd/$a/$b") | ||
fi | ||
done < <(grep '^/cmd/' $file | sed -e 's#/cmd/##' -e 's#/# #g') | ||
|
||
if [ ${#missing[@]} -gt 0 ]; then | ||
echo "missing the following rules:" | ||
for rule in "${missing[@]}"; do | ||
echo "$rule" | ||
done | ||
exit 2 | ||
ret=2 | ||
fi | ||
|
||
if [ ${#malformed[@]} -gt 0 ]; then | ||
echo "malformed rules:" | ||
for rule in "${malformed[@]}"; do | ||
echo "$rule" | ||
done | ||
ret=2 | ||
fi | ||
|
||
if [ ${#extraneous[@]} -gt 0 ]; then | ||
echo "extraneous rules:" | ||
for rule in "${extraneous[@]}"; do | ||
echo "$rule" | ||
done | ||
ret=2 | ||
fi | ||
|
||
sorted=$(mktemp) | ||
LC_ALL=en_US sort $file > $sorted | ||
if ! cmp --silent $file $sorted; then | ||
echo ".gitignore file needs sorting" | ||
diff $file $sorted | ||
rm $sorted | ||
ret=2 | ||
fi | ||
|
||
echo "gitignore rules for all binaries found" | ||
[ $ret -gt 0 ] && exit $ret | ||
|
||
echo "all gitignore rules for commands in sync with cmd directory" |
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# this tool detects "ineffectual assignments" | ||
# not very clear but you may find some more info on | ||
# https://github.com/gordonklaus/ineffassign | ||
|
||
# find the dir we exist within... | ||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
# and cd into root project dir | ||
cd ${DIR}/../.. | ||
go get -u -v github.com/gordonklaus/ineffassign | ||
go get -u github.com/gordonklaus/ineffassign | ||
ineffassign . |
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 |
---|---|---|
@@ -1,19 +1,9 @@ | ||
#!/bin/bash | ||
|
||
if ! which dep >/dev/null; then | ||
go get -u github.com/golang/dep/cmd/dep || exit 1 | ||
fi | ||
# checks whether vendor directory is healthy | ||
|
||
dep version | ||
|
||
# until we have https://docs.google.com/document/d/1j_Hka8eFKqWwGJWFSFedtBsNkFaRN3yvL4g8k30PLmg/edit# | ||
# this should do fine: | ||
# (note dep ensure -dry-run and dep ensure would add a whole bunch of packages to vendor, which dep prune deletes again, so we can't just check those) | ||
# we can expect this to change soon though: https://github.com/golang/dep/issues/944 | ||
|
||
dep ensure -no-vendor -dry-run | ||
ret=$? | ||
go get -u github.com/golang/dep/cmd/dep | ||
|
||
dep version | ||
dep status | ||
|
||
exit $ret | ||
dep check |
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,13 @@ | ||
#!/bin/bash | ||
# go vet has high confidence checks and low confidence ones. | ||
# for the purpose of CI, we shall only execute the high confidence ones. | ||
# we can just follow the ones `go test` uses, it's not documented, but | ||
# see https://github.com/golang/go/blob/release-branch.go1.10/src/cmd/go/internal/test/test.go#L509-L533 | ||
# NOTE: why not just rely on the auto go vet execution via go test -> because not all packages use go test | ||
|
||
# find the dir we exist within... | ||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
# and cd into root project dir | ||
cd ${DIR}/../.. | ||
|
||
go vet -atomic -bool -buildtags -nilfunc -printf ./... |
Oops, something went wrong.