Document our linting practices
Signed-off-by: Nic Cope <negz@rk0n.org>
This commit is contained in:
parent
78199c28a2
commit
8c6a6395e2
|
|
@ -52,17 +52,49 @@ This is a rough outline of what a contributor's workflow looks like:
|
||||||
- Make your changes and arrange them in readable commits.
|
- Make your changes and arrange them in readable commits.
|
||||||
- Make sure your commit messages are in the proper format (see below).
|
- Make sure your commit messages are in the proper format (see below).
|
||||||
- Push your changes to the branch in your fork of the repository.
|
- Push your changes to the branch in your fork of the repository.
|
||||||
- Make sure all tests pass, and add any new tests as appropriate.
|
- Make sure all linters and tests pass, and add any new tests as appropriate.
|
||||||
- Submit a pull request to the original repository.
|
- Submit a pull request to the original repository.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
Details about building crossplane can be found in [INSTALL.md](INSTALL.md).
|
Details about building crossplane can be found in [INSTALL.md](INSTALL.md).
|
||||||
|
|
||||||
## Coding Style
|
## Coding Style and Linting
|
||||||
|
|
||||||
Crossplane projects are written in golang and follows the style guidelines dictated by
|
Crossplane projects are written in Go. Coding style is enforced by
|
||||||
the go fmt as well as go vet tools.
|
[golangci-lint](https://github.com/golangci/golangci-lint). Crossplane's linter
|
||||||
|
configuration is [documented here](.golangci.yml). Builds will fail locally and
|
||||||
|
in CI if linter warnings are introduced:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ make build
|
||||||
|
==> Linting /REDACTED/go/src/github.com/crossplaneio/crossplane/cluster/charts/crossplane
|
||||||
|
[INFO] Chart.yaml: icon is recommended
|
||||||
|
|
||||||
|
1 chart(s) linted, no failures
|
||||||
|
20:31:42 [ .. ] helm dep crossplane 0.1.0-136.g2dfb012.dirty
|
||||||
|
No requirements found in /REDACTED/go/src/github.com/crossplaneio/crossplane/cluster/charts/crossplane/charts.
|
||||||
|
20:31:42 [ OK ] helm dep crossplane 0.1.0-136.g2dfb012.dirty
|
||||||
|
20:31:42 [ .. ] golangci-lint
|
||||||
|
pkg/clients/azure/redis/redis.go:35:7: exported const `NamePrefix` should have comment or be unexported (golint)
|
||||||
|
const NamePrefix = "acr"
|
||||||
|
^
|
||||||
|
20:31:55 [FAIL]
|
||||||
|
make[2]: *** [go.lint] Error 1
|
||||||
|
make[1]: *** [build.all] Error 2
|
||||||
|
make: *** [build] Error 2
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that Jenkins builds will not output linter warnings in the build log.
|
||||||
|
Instead `upbound-bot` will leave comments on your pull request when a build
|
||||||
|
fails due to linter warnings. You can run `make lint` locally to help determine
|
||||||
|
whether you've fixed any linter warnings detected by Jenkins.
|
||||||
|
|
||||||
|
In some cases linter warnings will be false positives. `golangci-lint` supports
|
||||||
|
`//nolint[:lintername]` comment directives in order to quell them. Please
|
||||||
|
include an explanatory comment if you must add a `//nolint` comment. You may
|
||||||
|
also submit a PR against [`.golangci.yml`](.golangci.yml) if you feel
|
||||||
|
particular linter warning should be permanently disabled.
|
||||||
|
|
||||||
## Comments
|
## Comments
|
||||||
|
|
||||||
|
|
|
||||||
2
build
2
build
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1f3b6b720f96f6c82445e331af98ca61502adb12
|
Subproject commit ea382a1202c8f83f9f9e93f8130eab5fd5b442c2
|
||||||
Loading…
Reference in New Issue