diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-04 18:10:20 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-04 18:10:20 +0000 |
commit | 9bbcab8301ed38576debcb6a7f07f99005ff805a (patch) | |
tree | 20e348b90c8fc27db66a68d6a87546448590f31b /doc/development/shell_scripting_guide/index.md | |
parent | 39a548dd06b8ddcc0d2acb7832460f5fe1876521 (diff) | |
download | gitlab-ce-9bbcab8301ed38576debcb6a7f07f99005ff805a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/shell_scripting_guide/index.md')
-rw-r--r-- | doc/development/shell_scripting_guide/index.md | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/doc/development/shell_scripting_guide/index.md b/doc/development/shell_scripting_guide/index.md index 387ef01bdcf..99cd1b9d67f 100644 --- a/doc/development/shell_scripting_guide/index.md +++ b/doc/development/shell_scripting_guide/index.md @@ -80,7 +80,20 @@ We format shell scripts according to the [Google Shell Style Guide](https://goog so the following `shfmt` invocation should be applied to the project's script files: ```shell -shfmt -i 2 -ci scripts/**/*.sh +shfmt -i 2 -ci -w scripts/**/*.sh +``` + +In addition to the [Linting](#linting) GitLab CI/CD job, all projects with shell scripts should also +use this job: + +```yaml +shfmt: + image: mvdan/shfmt:v3.1.0-alpine + stage: test + before_script: + - shfmt -version + script: + - shfmt -i 2 -ci -d scripts # path to your shell scripts ``` TIP: **Tip:** @@ -88,11 +101,6 @@ By default, shfmt will use the [shell detection](https://github.com/mvdan/sh#shf and ignore files starting with a period. To override this, use `-ln` flag to specify the shell dialect: `-ln posix` or `-ln bash`. -NOTE: **Note:** -Currently, the `shfmt` tool [is not shipped](https://github.com/mvdan/sh/issues/68) as a Docker image containing -a Linux shell. This makes it impossible to use the [official Docker image](https://hub.docker.com/r/mvdan/shfmt) -in GitLab Runner. This [may change](https://github.com/mvdan/sh/issues/68#issuecomment-507721371) in future. - ## Testing NOTE: **Note:** |