Skip to content

Commit e18fc35

Browse files
committed
Avoid excessive indentation in shell commands
The project's GitHub Actions workflows and tasks contain complex shell command lines. With the use of the line continuation operator, these commands can be split into multiple code lines. This improves readability by providing a visualization of the command structure. It also improves maintainability by making diffs for changes to these commands more clear. The readability can be further improved by indentation of the subsequent lines of the command in a manner that visually conveys the structure. Previously, in cases where multiple commands are chained via control or list operators, the subsequent commands were indented relative to the prior command in the chain. Although this did help to visually convey the structure, it also resulted in excessive levels of indentation. It also resulted in some visual ambiguity between indentation used for arguments to a command, and that for subsequent commands in the chain. For these reasons, the determination was made to not indent the subsequent commands in the chain. The structure is communicated by placing the operator linking the commands on a dedicated line.
1 parent fa2aff7 commit e18fc35

File tree

4 files changed

+19
-28
lines changed

4 files changed

+19
-28
lines changed

.github/workflows/check-go-task.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,9 @@ jobs:
121121

122122
- name: Check if any fixes were needed
123123
run: |
124-
git \
125-
diff \
126-
--color \
127-
--exit-code
124+
git diff \
125+
--color \
126+
--exit-code
128127
129128
check-style:
130129
name: check-style (${{ matrix.module.path }})
@@ -201,10 +200,9 @@ jobs:
201200

202201
- name: Check formatting
203202
run: |
204-
git \
205-
diff \
206-
--color \
207-
--exit-code
203+
git diff \
204+
--color \
205+
--exit-code
208206
209207
check-config:
210208
name: check-config (${{ matrix.module.path }})
@@ -236,7 +234,6 @@ jobs:
236234

237235
- name: Check whether any tidying was needed
238236
run: |
239-
git \
240-
diff \
241-
--color \
242-
--exit-code
237+
git diff \
238+
--color \
239+
--exit-code

.github/workflows/check-npm-task.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,12 @@ jobs:
116116

117117
- name: Install npm dependencies
118118
run: |
119-
task \
120-
npm:install-deps \
119+
task npm:install-deps \
121120
PROJECT_PATH="${{ matrix.project.path }}"
122121
123122
- name: Check package-lock.json
124123
run: |
125-
git \
126-
diff \
127-
--color \
128-
--exit-code \
129-
"${{ matrix.project.path }}/package-lock.json"
124+
git diff \
125+
--color \
126+
--exit-code \
127+
"${{ matrix.project.path }}/package-lock.json"

.github/workflows/check-prettier-formatting-task.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,10 @@ jobs:
268268
version: 3.x
269269

270270
- name: Format with Prettier
271-
run: |
272-
task \
273-
general:format-prettier
271+
run: task general:format-prettier
274272

275273
- name: Check formatting
276274
run: |
277-
git \
278-
diff \
279-
--color \
280-
--exit-code
275+
git diff \
276+
--color \
277+
--exit-code

.github/workflows/check-yaml-task.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,5 @@ jobs:
108108
- name: Check YAML
109109
continue-on-error: ${{ matrix.configuration.continue-on-error }}
110110
run: |
111-
task \
112-
yaml:lint \
111+
task yaml:lint \
113112
YAMLLINT_FORMAT=${{ matrix.configuration.format }}

0 commit comments

Comments
 (0)