Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
086193d8
Commit
086193d8
authored
May 04, 2020
by
Adam Cohen
Committed by
Nick Gaskill
May 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add docs for running shfmt on shell scripts
parent
e25b7b91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
doc/development/shell_scripting_guide/index.md
doc/development/shell_scripting_guide/index.md
+14
-6
No files found.
doc/development/shell_scripting_guide/index.md
View file @
086193d8
...
@@ -80,7 +80,20 @@ We format shell scripts according to the [Google Shell Style Guide](https://goog
...
@@ -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:
so the following
`shfmt`
invocation should be applied to the project's script files:
```
shell
```
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:**
TIP:
**Tip:**
...
@@ -88,11 +101,6 @@ By default, shfmt will use the [shell detection](https://github.com/mvdan/sh#shf
...
@@ -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:
and ignore files starting with a period. To override this, use
`-ln`
flag to specify the shell dialect:
`-ln posix`
or
`-ln bash`
.
`-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
## Testing
NOTE:
**Note:**
NOTE:
**Note:**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment