Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions backends/arm/scripts/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# Copyright 2025 Arm Limited and/or its affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# Check 1: If commit header contains WIP, everything is ok
git rev-list --format=%s --max-count=1 HEAD | grep -q WIP && exit 0

# Check 2: lintunner on latest patch.
lintrunner -a --revision 'HEAD^' --skip MYPY
commit_files=$(git diff-tree --no-commit-id --name-only --diff-filter=M HEAD -r)
git add $commit_files || true
45 changes: 45 additions & 0 deletions backends/arm/scripts/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
# Copyright 2025 Arm Limited and/or its affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# Check 1: If commit header contains WIP, everything is ok
git rev-list --format=%s --max-count=1 HEAD | grep -q WIP && exit 0

# Check 2: lintunner on latest patches.
lintrunner --revision 'HEAD^'
if [[ $? != 0 ]]
then
echo "Failed linting"
exit 1
fi

# Check 3: License headers
# We do a simple check of if all committed headers contain "$current_year Arm".
# This does not guarantee OK in ci but should be ok most of the time.

current_year=$(date +%Y)
failed_license_check=false
commit_files=$(git diff-tree --no-commit-id --name-only --diff-filter=ACMR HEAD -r)


for commited_file in $commit_files; do
head $commited_file | grep -q "$current_year Arm"
if [[ $? != 0 ]]
then
echo "Header in $commited_file did not contain '$current_year Arm'"
failed_license_check=true
else
echo "$commited_file passed license check"
fi
done

if [[ $failed_license_check == true ]]
then
exit 1
else
echo "Passed simple license check"
fi

exit 0
9 changes: 9 additions & 0 deletions backends/arm/scripts/setup-dev-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# Copyright 2025 Arm Limited and/or its affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

git_dir=$(git rev-parse --git-dir)
ln $git_dir/../backends/arm/scripts/pre-push $git_dir/hooks
ln $git_dir/../backends/arm/scripts/pre-commit $git_dir/hooks
Loading