diff --git a/docs/development/testing.md b/docs/development/testing.md index bdfe11bb65..ae0ba028a6 100644 --- a/docs/development/testing.md +++ b/docs/development/testing.md @@ -45,6 +45,16 @@ This allow us to use test doubles in the unit tests, from where we can instantia Counterfeiter is required by the code generator scripts. Run `make install-counterfeiter` to add counterfeiter to your `GOPATH`. +### Static code analysis and linting + +Run `make sanity-check` to run a collection of static code analyser and linters to check the code for issues, for example ineffective assignments, unused variables, missing comments, misspellings and so on. Each check also has an individual Make target to check: + +- `make govet` examines Go source code and reports suspicious constructs +- `make ineffassign` checks Go source for variable assignments that are not used (i.e. overridden) +- `make golint` runs a linter against the Go source +- `make misspell` checks for TYPOs +- `make staticcheck` performs more complex static code analysis to find unused code and other issues + ## Unit Tests We use unit tests to provide coverage and ensure that our functions are behaving as expected, but also to assert the behaviour of the controllers during Reconciliations. @@ -208,4 +218,3 @@ make test-e2e \ TEST_PRIVATE_GITLAB="git@gitlab.com:/.git" \ TEST_SOURCE_SECRET="" ``` -