Skip to content

Commit 23f5763

Browse files
committed
Add details about code check to testing doc
Introduce section to explain the new Makefile targets.
1 parent 4bc04b2 commit 23f5763

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docs/development/testing.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ This allow us to use test doubles in the unit tests, from where we can instantia
4545

4646
Counterfeiter is required by the code generator scripts. Run `make install-counterfeiter` to add counterfeiter to your `GOPATH`.
4747

48+
### Static code analysis and linting
49+
50+
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:
51+
52+
- `make govet` examines Go source code and reports suspicious constructs
53+
- `make ineffassign` checks Go source for variable assignments that are not used (i.e. overridden)
54+
- `make golint` runs a linter against the Go source
55+
- `make misspell` checks for TYPOs
56+
- `make staticcheck` performs more complex static code analysis to find unused code and other issues
57+
4858
## Unit Tests
4959

5060
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 \
208218
TEST_PRIVATE_GITLAB="[email protected]:<youruser>/<your-repo>.git" \
209219
TEST_SOURCE_SECRET="<secret-name>"
210220
```
211-

0 commit comments

Comments
 (0)