Commit Graph

20 Commits

Author SHA1 Message Date
Christopher Goes a4e7216b36 Fix gocyclo check 2018-07-17 02:29:46 +02:00
ValarDragon 0c5358c267 Continue reducing code complexity:
* 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
2018-07-09 15:29:16 -07:00
ValarDragon a768543d92 tools: Add code complexity linter, gocyclo
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.
2018-07-09 15:29:16 -07:00
ValarDragon 08e98d3124 tools: Switch gometalinter to use a config file 2018-07-07 12:00:06 -07:00
Dev Ojha 097dd8a164 tools: Add unparam linter (#1443)
* 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
2018-06-29 18:22:24 -04:00
Dev Ojha ac3adff1e8 Merge PR #1438: Tools: Add errcheck linter
This linter ensures that all errors are checked.
This is disabled in the client directories, since its not needed on
those writes
2018-06-29 00:52:10 +02:00
Dev Ojha 3e14868bd6 Merge PR #1429: tools: Add ineffassign linter
* 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
2018-06-28 19:12:02 +02:00
Dev Ojha 2755c66545 Merge PR #1424: tools: add unconvert linter
unconvert checks for unnecessary type conversions
2018-06-28 18:08:29 +02:00
Dev Ojha 15bba919e2 Merge PR #1341: Switch gometalinter to stable
* Switch gometalinter to stable
* Delete empty folder
2018-06-22 22:08:50 +02:00
Dev Ojha 7f1169db4d Merge PR #1337: tools: Fix makefile install scripts
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.
2018-06-22 20:01:44 +02:00
Pin Zhang fe3236da61 Fix bug: make will fail if the path contains whitespace 2018-03-09 13:06:36 +08:00
Ethan Buchman b5471212cf dont import metalinter 2018-03-08 19:48:17 +00:00
Ethan Buchman f25c9fc06a tools: get_tools 2018-03-08 19:48:17 +00:00
Adrian Brink e3c68e2640 Dep now works. Metalinter is broken 2018-03-08 19:48:17 +00:00
Adrian Brink c42f036318 Fix build, just tools/ missing 2018-03-08 19:48:17 +00:00
rigelrozanski 6f492b862c deleted glide files 2018-03-08 19:48:17 +00:00
Zaki Manian 9afe696bf4 Replace glide with dep 2018-03-08 19:48:17 +00:00
Zaki Manian ce689ab4f3 Switch dependency resolution to dep and update Makefile to use dep 2018-03-08 19:48:17 +00:00
Ethan Frey 43ea579079 Tools uses glide, not gopkg.in for versioning 2018-03-01 02:36:57 +00:00
Jae Kwon 81b6012021 Vendor tools into tools/* (#331)
* Add tools dir
* Update Makefile to call tools/Makefile
* Add cmd/basecoind to make make pass
2018-01-16 11:24:20 -08:00