From e18fc350abdc26fc10dab3ee58133cb39caab0ca Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 6 Sep 2025 09:49:14 -0700 Subject: [PATCH] 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. --- .github/workflows/check-go-task.yml | 21 ++++++++----------- .github/workflows/check-npm-task.yml | 12 +++++------ .../check-prettier-formatting-task.yml | 11 ++++------ .github/workflows/check-yaml-task.yml | 3 +-- 4 files changed, 19 insertions(+), 28 deletions(-) diff --git a/.github/workflows/check-go-task.yml b/.github/workflows/check-go-task.yml index 9d29ff1..496c6ca 100644 --- a/.github/workflows/check-go-task.yml +++ b/.github/workflows/check-go-task.yml @@ -121,10 +121,9 @@ jobs: - name: Check if any fixes were needed run: | - git \ - diff \ - --color \ - --exit-code + git diff \ + --color \ + --exit-code check-style: name: check-style (${{ matrix.module.path }}) @@ -201,10 +200,9 @@ jobs: - name: Check formatting run: | - git \ - diff \ - --color \ - --exit-code + git diff \ + --color \ + --exit-code check-config: name: check-config (${{ matrix.module.path }}) @@ -236,7 +234,6 @@ jobs: - name: Check whether any tidying was needed run: | - git \ - diff \ - --color \ - --exit-code + git diff \ + --color \ + --exit-code diff --git a/.github/workflows/check-npm-task.yml b/.github/workflows/check-npm-task.yml index 7e1167b..d5bf6f8 100644 --- a/.github/workflows/check-npm-task.yml +++ b/.github/workflows/check-npm-task.yml @@ -116,14 +116,12 @@ jobs: - name: Install npm dependencies run: | - task \ - npm:install-deps \ + task npm:install-deps \ PROJECT_PATH="${{ matrix.project.path }}" - name: Check package-lock.json run: | - git \ - diff \ - --color \ - --exit-code \ - "${{ matrix.project.path }}/package-lock.json" + git diff \ + --color \ + --exit-code \ + "${{ matrix.project.path }}/package-lock.json" diff --git a/.github/workflows/check-prettier-formatting-task.yml b/.github/workflows/check-prettier-formatting-task.yml index 6dec824..1dd347c 100644 --- a/.github/workflows/check-prettier-formatting-task.yml +++ b/.github/workflows/check-prettier-formatting-task.yml @@ -268,13 +268,10 @@ jobs: version: 3.x - name: Format with Prettier - run: | - task \ - general:format-prettier + run: task general:format-prettier - name: Check formatting run: | - git \ - diff \ - --color \ - --exit-code + git diff \ + --color \ + --exit-code diff --git a/.github/workflows/check-yaml-task.yml b/.github/workflows/check-yaml-task.yml index b0d585c..75c17a4 100644 --- a/.github/workflows/check-yaml-task.yml +++ b/.github/workflows/check-yaml-task.yml @@ -108,6 +108,5 @@ jobs: - name: Check YAML continue-on-error: ${{ matrix.configuration.continue-on-error }} run: | - task \ - yaml:lint \ + task yaml:lint \ YAMLLINT_FORMAT=${{ matrix.configuration.format }}