This is basically copying over @anton's great script!
Also had to run `make format` to make this pass `test_lint`.
This PR also makes the make commands for tools further align
with the tendermint implementation.
* Adds a Min function to Int, and uses that in the slash function
* Adds a getHeight helper function to iavlstore
* Adds a splitPath function to baseapp
* Changes cyclo param from 10 to 11
Gocyclo is a code complexity linter. It uses cyclomatic complexity.
Cyclomatic complexity essentially measures the number of different
paths code could go through. (The conditional in a for loop counts
as adding one path) It looks at this on a per-function level. The
idea that this would be enforcing is that if there are too many
different paths code can go through in a function, it needs to be
better split up. (A function with too many code paths is hard to
reason about)
The complexity which we want the linter to start failing on is
configurable. The default is 10. Change the "Cyclo" parameter in
`tools/gometalinter.json` to try other values.
* tools: Add unparam linter
unparam detects unused parameters in functions, and a parameter to
a function which only ever takes on one value. The latter is an
indication that more tests are required.
There are many nolints in this PR, as I believe that writing tests
to fix alot of these situations is out of scope for this PR / it
will be changed in future commits. There are some nolints for
when we have to comply to normal api's.
* crypto/keys no longer used by x/gov/client/rest/rest.go
* tools: Add ineffassign linter
This errors on assignments that don't actually do anything. i.e.
x, err := myFunc(1)
y, err = myFunc(2)
This will call out that the first function's call error was never
used.
* Fix makefile, add misspell to makefile
Previously, the install scripts weren't installing golint and gometalinter.
This commit fixes this, and installs tendermints linter, and the HEAD of
the gometalinter repository. Now make all should work.