mirror of https://github.com/matrix-org/gomatrix
Add misspell and ineffassign to the pre-commit hooks
This commit is contained in:
parent
27ae91d1b3
commit
735a423c76
|
@ -79,7 +79,7 @@ func (cli *Client) BuildBaseURL(urlPath ...string) string {
|
||||||
return hsURL.String()
|
return hsURL.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildURLWithQuery builds a URL with query paramters in addition to the Client's homeserver/prefix/access_token set already.
|
// BuildURLWithQuery builds a URL with query parameters in addition to the Client's homeserver/prefix/access_token set already.
|
||||||
func (cli *Client) BuildURLWithQuery(urlPath []string, urlQuery map[string]string) string {
|
func (cli *Client) BuildURLWithQuery(urlPath []string, urlQuery map[string]string) string {
|
||||||
u, _ := url.Parse(cli.BuildURL(urlPath...))
|
u, _ := url.Parse(cli.BuildURL(urlPath...))
|
||||||
q := u.Query()
|
q := u.Query()
|
||||||
|
|
|
@ -3,6 +3,23 @@
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
golint
|
golint
|
||||||
|
misspell --error .
|
||||||
|
|
||||||
|
# gofmt doesn't exit with an error code if the files don't match the expected
|
||||||
|
# format. So we have to run it and see if it outputs anything.
|
||||||
|
if gofmt -l -s . 2>&1 | read
|
||||||
|
then
|
||||||
|
echo "Error: not all code had been formatted with gofmt."
|
||||||
|
echo "Fixing the following files"
|
||||||
|
gofmt -s -w -l .
|
||||||
|
echo
|
||||||
|
echo "Please add them to the commit"
|
||||||
|
git status --short
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ineffassign .
|
||||||
|
|
||||||
go fmt
|
go fmt
|
||||||
go tool vet --all --shadow .
|
go tool vet --all --shadow .
|
||||||
gocyclo -over 12 .
|
gocyclo -over 12 .
|
||||||
|
|
Loading…
Reference in New Issue