forgejo: make aarch64 asm linter part of pre-commit

Needed some minor semantical changes to the shell wrapper, since
pre-commit expects it to exit with an error when applying fixes.
This commit is contained in:
Timo Rothenpieler
2025-09-12 19:19:30 +02:00
committed by Martin Storsjö
parent edd1b93e53
commit 4c80cda08a
3 changed files with 15 additions and 8 deletions

View File

@@ -18,6 +18,14 @@ repos:
- id: fix-byte-order-marker - id: fix-byte-order-marker
- id: mixed-line-ending - id: mixed-line-ending
- id: trailing-whitespace - id: trailing-whitespace
- repo: local
hooks:
- id: aarch64-asm-indent
name: fix aarch64 assembly indentation
files: ^.*/aarch64/.*\.S$
language: script
entry: ./tools/check_arm_indent.sh --apply
pass_filenames: false
- repo: https://github.com/codespell-project/codespell - repo: https://github.com/codespell-project/codespell
rev: v2.4.1 rev: v2.4.1
hooks: hooks:

View File

@@ -24,5 +24,3 @@ jobs:
key: pre-commit-${{ steps.install.outputs.envhash }} key: pre-commit-${{ steps.install.outputs.envhash }}
- name: Run pre-commit CI - name: Run pre-commit CI
run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files
- name: Check aarch64 assembly indentation
run: ./tools/check_arm_indent.sh

View File

@@ -39,12 +39,13 @@ for i in */aarch64/*.S */aarch64/*/*.S; do
# Skip files with known (and tolerated) deviations from the tool. # Skip files with known (and tolerated) deviations from the tool.
continue continue
esac esac
cat $i | ./tools/indent_arm_assembly.pl > tmp.S ./tools/indent_arm_assembly.pl < "$i" > tmp.S || ret=$?
if [ -n "$apply" ]; then if ! git diff --quiet --no-index "$i" tmp.S; then
mv tmp.S $i if [ -n "$apply" ]; then
continue mv tmp.S "$i"
fi else
if ! PAGER=cat git diff --no-index $i tmp.S; then git --no-pager diff --no-index "$i" tmp.S
fi
ret=1 ret=1
fi fi
done done