Skip to content

Commit fd2b595

Browse files
committed
Add option for soft linting
Add a debug option for making linting jobs not fail if there are errors. Temporarily set it to `true` until some other PRs are merged.
1 parent 84d99b1 commit fd2b595

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,20 @@ on:
3838
description: 'Run with debugging options'
3939
type: boolean
4040
default: true
41+
soft-linting:
42+
description: 'Do not quit for linting errors'
43+
type: boolean
44+
default: true
4145

4246
env:
4347
# Python version to use for actions/setup-python.
4448
python-version: '3.13'
4549
SHELLOPTS: ${{inputs.debug && 'xtrace'}}
4650
PIP_PROGRESS_BAR: 'off'
51+
# Global flag determining whether lint errors are fatal.
52+
# TODO(mhucka): uncomment next line & delete 2nd after formatting PRs merged.
53+
# soft-linting: ${{inputs.soft-linting}}
54+
soft-linting: true
4755

4856
concurrency:
4957
cancel-in-progress: true
@@ -75,14 +83,16 @@ jobs:
7583
run: pip install -r requirements.txt -r dev-requirements.txt
7684

7785
- name: Check format
86+
continue-on-error: ${{env.soft-linting == 'true'}}
7887
run: |
7988
echo '::add-matcher::.github/problem-matchers/black.json'
80-
check/format-incremental --all
89+
check/format-incremental
8190
8291
- name: Check lint
92+
continue-on-error: ${{env.soft-linting == 'true'}}
8393
run: |
8494
echo '::add-matcher::.github/problem-matchers/pylint.json'
85-
pylint -j 0 -v .
95+
pylint ${{env.soft-linting && '--exit-zero'}} -j 0 .
8696
8797
docker-lint:
8898
name: Dockerfile lint checks
@@ -102,7 +112,8 @@ jobs:
102112
find . -name Dockerfile | while IFS= read -r file; do
103113
echo "Checking ${file} ..."
104114
docker run --rm -i -v "${PWD}"/.hadolint.yaml:/.config/hadolint.yaml \
105-
ghcr.io/hadolint/hadolint@${{env.hadolint_version}} < "${file}"
115+
ghcr.io/hadolint/hadolint@${{env.hadolint_version}} \
116+
${{env.soft-linting && '--no-fail'}} < "${file}"
106117
done
107118
echo 'Done ...'
108119
@@ -120,6 +131,7 @@ jobs:
120131
run: echo '::add-matcher::.github/problem-matchers/shellcheck.json'
121132

122133
- name: Run ShellCheck
134+
continue-on-error: ${{env.soft-linting == 'true'}}
123135
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38
124136
with:
125137
severity: error
@@ -143,6 +155,7 @@ jobs:
143155
sudo apt-get install --no-install-recommends -y yamllint
144156
145157
- name: Lint the YAML files
158+
continue-on-error: ${{env.soft-linting == 'true'}}
146159
run: |
147160
echo "::add-matcher::.github/problem-matchers/yamllint.json"
148161
find . -name '*.yaml' -o -name '*.yml' | \
@@ -165,6 +178,7 @@ jobs:
165178
buildifier-version: '8.2.1'
166179

167180
- name: Run Buildifier in lint mode
181+
continue-on-error: ${{env.soft-linting == 'true'}}
168182
run: |
169183
echo '::add-matcher::.github/problem-matchers/buildifier.json'
170184
# shellcheck disable=SC2038
@@ -187,6 +201,7 @@ jobs:
187201
flags: ${{inputs.debug && '-verbose'}}
188202
files: '.github/workflows/*.{yaml,yml}'
189203
pyflakes: false
204+
fail-on-error: ${{!env.soft-linting}}
190205

191206
library-tests:
192207
name: Library tests

0 commit comments

Comments
 (0)