Skip to content

Commit ee97010

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 db613c1 commit ee97010

File tree

2 files changed

+42
-32
lines changed

2 files changed

+42
-32
lines changed

.github/workflows/check-certificates.yml

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ jobs:
100100
-legacy \
101101
-noout \
102102
-passin env:CERTIFICATE_PASSWORD
103-
) || (
103+
) \
104+
|| \
105+
(
104106
echo "::error::Verification of ${{ matrix.certificate.identifier }} failed!!!"
105107
exit 1
106108
)
@@ -124,39 +126,45 @@ jobs:
124126
run: |
125127
if [[ ${{ matrix.certificate.type }} == "pkcs12" ]]; then
126128
EXPIRATION_DATE="$(
127-
(
129+
(
128130
openssl pkcs12 \
129-
-in ${{ env.CERTIFICATE_PATH }} \
130-
-clcerts \
131-
-legacy \
132-
-nodes \
133-
-passin env:CERTIFICATE_PASSWORD
134-
) | (
131+
-in ${{ env.CERTIFICATE_PATH }} \
132+
-clcerts \
133+
-legacy \
134+
-nodes \
135+
-passin env:CERTIFICATE_PASSWORD
136+
) \
137+
| \
138+
(
135139
openssl x509 \
136-
-noout \
137-
-enddate
138-
) | (
140+
-noout \
141+
-enddate
142+
) \
143+
| \
144+
(
139145
grep \
140-
--max-count=1 \
141-
--only-matching \
142-
--perl-regexp \
143-
'notAfter=(\K.*)'
144-
)
146+
--max-count=1 \
147+
--only-matching \
148+
--perl-regexp \
149+
'notAfter=(\K.*)'
150+
)
145151
)"
146152
elif [[ ${{ matrix.certificate.type }} == "x509" ]]; then
147153
EXPIRATION_DATE="$(
148-
(
154+
(
149155
openssl x509 \
150-
-in ${{ env.CERTIFICATE_PATH }} \
151-
-noout \
152-
-enddate
153-
) | (
156+
-in ${{ env.CERTIFICATE_PATH }} \
157+
-noout \
158+
-enddate
159+
) \
160+
| \
161+
(
154162
grep \
155-
--max-count=1 \
156-
--only-matching \
157-
--perl-regexp \
158-
'notAfter=(\K.*)'
159-
)
163+
--max-count=1 \
164+
--only-matching \
165+
--perl-regexp \
166+
'notAfter=(\K.*)'
167+
)
160168
)"
161169
fi
162170

Taskfile.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ vars:
1212
DEFAULT_GO_MODULE_PATH: ./
1313
DEFAULT_GO_PACKAGES: |
1414
$( \
15-
go list ./... | \
16-
grep --invert-match 'github.com/arduino/arduino-lint/internal/rule/schema/schemadata' | \
17-
tr '\n' ' ' \
15+
go list ./... \
16+
| \
17+
grep --invert-match 'github.com/arduino/arduino-lint/internal/rule/schema/schemadata' \
18+
| \
19+
tr '\n' ' ' \
1820
|| \
1921
echo '"ERROR: Unable to discover Go packages"' \
2022
)
@@ -589,9 +591,9 @@ tasks:
589591
cmds:
590592
- |
591593
if [[ "{{.OS}}" == "Windows_NT" ]] && which cygpath &>/dev/null; then
592-
# Even though the shell handles POSIX format absolute paths as expected, external applications do not.
593-
# So paths passed to such applications must first be converted to Windows format.
594-
cygpath -w "{{.RAW_PATH}}"
594+
# Even though the shell handles POSIX format absolute paths as expected, external applications do not.
595+
# So paths passed to such applications must first be converted to Windows format.
596+
cygpath -w "{{.RAW_PATH}}"
595597
else
596598
echo "{{.RAW_PATH}}"
597599
fi

0 commit comments

Comments
 (0)