Skip to content

Commit 83027a8

Browse files
authored
Merge pull request #643 from per1234/format-shell
Improve formatting of shell commands
2 parents 92bcb9c + fa91712 commit 83027a8

File tree

64 files changed

+1128
-378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1128
-378
lines changed

.github/workflows/check-ci-sync.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,21 @@ jobs:
4040
version: 3.x
4141

4242
- name: Sync files
43-
run: task --silent ci:sync
43+
run: |
44+
task \
45+
--silent \
46+
ci:sync
4447
4548
- name: Check file duplicates sync
4649
run: |
4750
git add .
48-
if ! git diff --color --exit-code HEAD; then
51+
52+
if
53+
! git diff \
54+
--color \
55+
--exit-code \
56+
HEAD
57+
then
4958
echo "::error::File duplicates are out of sync. Please run \"task fix\""
5059
exit 1
5160
fi

.github/workflows/check-clang-format.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ jobs:
5555
version: 3.x
5656

5757
- name: Validate ClangFormat configuration files
58-
run: task --silent clang-format:validate
58+
run: |
59+
task \
60+
--silent \
61+
clang-format:validate
5962
6063
check-config:
6164
runs-on: ubuntu-latest
@@ -79,6 +82,7 @@ jobs:
7982
else
8083
echo "CLANG_FORMAT_VERSION=${{ github.event.inputs.clang-format-version }}" >> "$GITHUB_ENV"
8184
fi
85+
8286
echo "CLANG_FORMAT_INSTALL_PATH=${{ runner.temp }}/clang-format" >> "$GITHUB_ENV"
8387
echo "YQ_INSTALL_PATH=${{ runner.temp }}/yq" >> "$GITHUB_ENV"
8488
echo "WORKING_FOLDER=${{ runner.temp }}" >> "$GITHUB_ENV"
@@ -95,7 +99,11 @@ jobs:
9599
- name: Install ClangFormat
96100
run: |
97101
cd "${{ env.CLANG_FORMAT_INSTALL_PATH }}"
98-
tar --extract --file="${{ steps.download-clang-format.outputs.name }}"
102+
103+
tar \
104+
--extract \
105+
--file="${{ steps.download-clang-format.outputs.name }}"
106+
99107
# Add installation to PATH:
100108
# See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path
101109
echo "${{ env.CLANG_FORMAT_INSTALL_PATH }}/clang_Linux_64bit" >> "$GITHUB_PATH"
@@ -111,7 +119,11 @@ jobs:
111119
- name: Install yq
112120
run: |
113121
cd "${{ env.YQ_INSTALL_PATH }}"
114-
tar --extract --file="${{ steps.download-yq.outputs.name }}"
122+
123+
tar \
124+
--extract \
125+
--file="${{ steps.download-yq.outputs.name }}"
126+
115127
# Add installation to PATH:
116128
# See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path
117129
echo "${{ env.YQ_INSTALL_PATH }}/yq" >> "$GITHUB_PATH"
@@ -156,6 +168,7 @@ jobs:
156168
else
157169
echo "CLANG_FORMAT_VERSION=${{ github.event.inputs.clang-format-version }}" >> "$GITHUB_ENV"
158170
fi
171+
159172
echo "CLANG_FORMAT_INSTALL_PATH=${{ runner.temp }}/clang-format" >> "$GITHUB_ENV"
160173
echo "WORKING_FOLDER=${{ runner.temp }}" >> "$GITHUB_ENV"
161174
@@ -171,7 +184,11 @@ jobs:
171184
- name: Install ClangFormat
172185
run: |
173186
cd "${{ env.CLANG_FORMAT_INSTALL_PATH }}"
174-
tar --extract --file="${{ steps.download.outputs.name }}"
187+
188+
tar \
189+
--extract \
190+
--file="${{ steps.download.outputs.name }}"
191+
175192
# Add installation to PATH:
176193
# See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path
177194
echo "${{ env.CLANG_FORMAT_INSTALL_PATH }}/clang_Linux_64bit" >> "$GITHUB_PATH"
@@ -209,7 +226,10 @@ jobs:
209226
version: 3.x
210227

211228
- name: Check ClangFormat test data
212-
run: task --silent clang-format:check-testdata
229+
run: |
230+
task \
231+
--silent \
232+
clang-format:check-testdata
213233
214234
convert:
215235
runs-on: ubuntu-latest

.github/workflows/check-community-health-sync.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,21 @@ jobs:
4646
version: 3.x
4747

4848
- name: Sync files
49-
run: task --silent github:sync
49+
run: |
50+
task \
51+
--silent \
52+
github:sync
5053
5154
- name: Check file duplicates sync
5255
run: |
5356
git add .
54-
if ! git diff --color --exit-code HEAD; then
57+
58+
if
59+
! git diff \
60+
--color \
61+
--exit-code \
62+
HEAD
63+
then
5564
echo "::error::File duplicates are out of sync. Please run \"task fix\""
5665
exit 1
5766
fi

.github/workflows/check-config-sync.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,21 @@ jobs:
3232
version: 3.x
3333

3434
- name: Sync files
35-
run: task --silent config:sync
35+
run: |
36+
task \
37+
--silent \
38+
config:sync
3639
3740
- name: Check file duplicates sync
3841
run: |
3942
git add .
40-
if ! git diff --color --exit-code HEAD; then
43+
44+
if
45+
! git diff \
46+
--color \
47+
--exit-code \
48+
HEAD
49+
then
4150
echo "::error::File duplicates are out of sync. Please run \"task fix\""
4251
exit 1
4352
fi

.github/workflows/check-eslint.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,7 @@ jobs:
4545
version: 3.x
4646

4747
- name: Validate workflows
48-
run: task --silent eslint:validate
48+
run: |
49+
task \
50+
--silent \
51+
eslint:validate

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ jobs:
5555
version: 3.x
5656

5757
- name: Check filenames
58-
run: task --silent general:check-filenames
58+
run: |
59+
task \
60+
--silent \
61+
general:check-filenames
5962
6063
check-symlinks:
6164
needs: run-determination
@@ -75,4 +78,7 @@ jobs:
7578
version: 3.x
7679

7780
- name: Check symlinks
78-
run: task --silent general:check-symlinks
81+
run: |
82+
task \
83+
--silent \
84+
general:check-symlinks

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,22 @@ jobs:
7171
- name: Install editorconfig-checker
7272
run: |
7373
cd "${{ env.EC_INSTALL_PATH }}"
74-
tar --extract --file="${{ steps.download.outputs.name }}"
74+
75+
tar \
76+
--extract \
77+
--file="${{ steps.download.outputs.name }}"
78+
7579
# Give the binary a standard name
76-
mv "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" "${{ env.EC_INSTALL_PATH }}/bin/ec"
80+
mv \
81+
"${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" \
82+
"${{ env.EC_INSTALL_PATH }}/bin/ec"
83+
7784
# Add installation to PATH:
7885
# See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path
7986
echo "${{ env.EC_INSTALL_PATH }}/bin" >> "$GITHUB_PATH"
8087
8188
- name: Check formatting
82-
run: task --silent general:check-formatting
89+
run: |
90+
task \
91+
--silent \
92+
general:check-formatting

.github/workflows/check-license.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ jobs:
8383
ruby-version: ruby # Install latest version
8484

8585
- name: Install licensee
86-
run: gem install licensee
86+
run: |
87+
gem install \
88+
licensee
8789
8890
- name: Check license file for ${{ matrix.check-license.path }}
8991
run: |
@@ -95,14 +97,26 @@ jobs:
9597
# See: https://github.com/licensee/licensee
9698
LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)"
9799
98-
DETECTED_LICENSE_FILE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].filename | tr --delete '\r')"
100+
DETECTED_LICENSE_FILE="$(
101+
echo "$LICENSEE_OUTPUT" \
102+
| \
103+
jq .matched_files[0].filename \
104+
| \
105+
tr --delete '\r'
106+
)"
99107
echo "Detected license file: $DETECTED_LICENSE_FILE"
100108
if [ "$DETECTED_LICENSE_FILE" != "\"${{ matrix.check-license.expected-filename }}\"" ]; then
101109
echo "::error file=${DETECTED_LICENSE_FILE}::detected license file $DETECTED_LICENSE_FILE doesn't match expected: ${{ matrix.check-license.expected-filename }}"
102110
EXIT_STATUS=1
103111
fi
104112
105-
DETECTED_LICENSE_TYPE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].matched_license | tr --delete '\r')"
113+
DETECTED_LICENSE_TYPE="$(
114+
echo "$LICENSEE_OUTPUT" \
115+
| \
116+
jq .matched_files[0].matched_license \
117+
| \
118+
tr --delete '\r'
119+
)"
106120
echo "Detected license type: $DETECTED_LICENSE_TYPE"
107121
if [ "$DETECTED_LICENSE_TYPE" != "\"${{ matrix.check-license.expected-type }}\"" ]; then
108122
echo "::error file=${DETECTED_LICENSE_FILE}::detected license type $DETECTED_LICENSE_TYPE doesn't match expected \"${{ matrix.check-license.expected-type }}\""

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,7 @@ jobs:
112112
version: 3.x
113113

114114
- name: Check links
115-
run: task --silent markdown:check-links
115+
run: |
116+
task \
117+
--silent \
118+
markdown:check-links

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

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ jobs:
8080
version: 3.x
8181

8282
- name: Validate package.json
83-
run: task --silent npm:validate PROJECT_PATH="${{ matrix.project.path }}"
83+
run: |
84+
task \
85+
--silent \
86+
npm:validate \
87+
PROJECT_PATH="${{ matrix.project.path }}"
8488
8589
check-sync:
8690
name: check-sync (${{ matrix.project.path }})
@@ -113,10 +117,16 @@ jobs:
113117
version: 3.x
114118

115119
- name: Install npm dependencies
116-
run: task npm:install-deps PROJECT_PATH="${{ matrix.project.path }}"
120+
run: |
121+
task npm:install-deps \
122+
PROJECT_PATH="${{ matrix.project.path }}"
117123
118124
- name: Check package-lock.json
119-
run: git diff --color --exit-code "${{ matrix.project.path }}/package-lock.json"
125+
run: |
126+
git diff \
127+
--color \
128+
--exit-code \
129+
"${{ matrix.project.path }}/package-lock.json"
120130
121131
check-config:
122132
name: check-config (${{ matrix.project.path }})
@@ -150,14 +160,12 @@ jobs:
150160

151161
- name: Fix problems in npm configuration file
152162
run: |
153-
task \
154-
npm:fix-config \
163+
task npm:fix-config \
155164
PROJECT_PATH="${{ matrix.project.path }}"
156165
157166
- name: Check if fixes are needed in npm configuration file
158167
run: |
159-
git \
160-
diff \
161-
--color \
162-
--exit-code \
163-
"${{ matrix.project.path }}/.npmrc"
168+
git diff \
169+
--color \
170+
--exit-code \
171+
"${{ matrix.project.path }}/.npmrc"

0 commit comments

Comments
 (0)