From 7c352427a2fd9180043762ec271fd9a3871696ea Mon Sep 17 00:00:00 2001 From: Justin Scott Date: Wed, 2 Oct 2019 11:19:22 -0700 Subject: [PATCH] Add section about code conventions to DEVELOP.md (#185) This adds details about shfmt and shellcheck settings. Closes #180 Signed-off-by: Justin Scott --- clr-k8s-examples/DEVELOP.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/clr-k8s-examples/DEVELOP.md b/clr-k8s-examples/DEVELOP.md index d6f6e31..0f26779 100644 --- a/clr-k8s-examples/DEVELOP.md +++ b/clr-k8s-examples/DEVELOP.md @@ -1,6 +1,36 @@ # Developer -This document describes the key concepts and technologies used in the project. +This document describes the key concepts and technologies used in the project, and lists the ways to contribute to the +project. + +## Code Conventions + +### Shell Scripts + +Shell scripts should adhere to the [Google Shell Style Guide](https://google.github.io/styleguide/shell.xml) as much as +possible. + +#### Formatting with `shfmt` + +The [shfmt](https://github.com/mvdan/sh#shfmt) tool should be used to format shell scripts with 2 spaces and should use +the following parameters: + +```shell script +shfmt -i 2 -ci +``` + +#### Linting with shellcheck + +The [shellcheck](https://github.com/koalaman/shellcheck) tool should be used to identify issues with the scripts +themselves. The config file for shellcheck is typically found in `~/.shellcheckrc` and should include rules that +are [ignored](https://github.com/koalaman/shellcheck/wiki/Ignore) project wide. + +```shell script +# ~/.shellcheckrc +# disabled rules here +``` + + ## Kustomize Usage