Skip to content

Commit 698a802

Browse files
authored
extend linter to enforce exception tracking is turned on (#5909)
Status Nim style mandates `{.push raises: []}.` at start of modules. Add a CI task to ensure exceptions keep getting properly tracked. - https://status-im.github.io/nim-style-guide/errors.exceptions.html - status-im/nim-eth#614 (comment)
1 parent 92197ce commit 698a802

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,21 +241,40 @@ jobs:
241241
excluded_extensions="ans|cfg|json|json\\.template|md|png|service|ssz|txt"
242242
243243
current_year=$(date +"%Y")
244-
outdated_files=()
244+
problematic_files=()
245245
while read -r file; do
246246
if ! grep -qE 'Copyright \(c\) .*'$current_year' Status Research & Development GmbH' "$file"; then
247-
outdated_files+=("$file")
247+
problematic_files+=("$file")
248248
fi
249249
done < <(git diff --name-only --diff-filter=AM --ignore-submodules HEAD^ HEAD | grep -vE '(\.('$excluded_extensions')|'$excluded_files')$' || true)
250250
251-
if (( ${#outdated_files[@]} )); then
251+
if (( ${#problematic_files[@]} )); then
252252
echo "The following files do not have an up-to-date copyright year:"
253-
for file in "${outdated_files[@]}"; do
253+
for file in "${problematic_files[@]}"; do
254254
echo "- $file"
255255
done
256256
exit 2
257257
fi
258258
259+
- name: Check exception tracking
260+
if: ${{ !cancelled() }} && github.event_name == 'pull_request'
261+
run: |
262+
problematic_files=()
263+
while read -r file; do
264+
if ! grep -qE '^{\.push raises: \[\]\.}' "$file"; then
265+
problematic_files+=("$file")
266+
fi
267+
done < <(git diff --name-only --diff-filter=AM --ignore-submodules HEAD^ HEAD | grep -E '\.nim$' || true)
268+
269+
if (( ${#problematic_files[@]} )); then
270+
echo "The following files do not have '{.push raises: []}':"
271+
for file in "${problematic_files[@]}"; do
272+
echo "- $file"
273+
done
274+
echo "See https://status-im.github.io/nim-style-guide/errors.exceptions.html"
275+
exit 2
276+
fi
277+
259278
- name: Check submodules
260279
if: ${{ !cancelled() }} && github.event_name == 'pull_request'
261280
run: |

0 commit comments

Comments
 (0)