Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
[#3] Add script to check existance of license header
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Oct 31, 2023
1 parent 6937a42 commit 3221f46
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 85 deletions.
27 changes: 27 additions & 0 deletions scripts/ci_test_spdx_license_header.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

cd $(git rev-parse --show-toplevel)

RET_VAL=0
FILES=$(find . -iwholename "*.rs")
CHECK_LICENSE="// SPDX-License-Identifier: Apache-2.0"

for FILE in $FILES
do
FIRST_LINE=$(head -n 1 $FILE)
SECOND_LINE=$(head -n 2 $FILE | tail -n 1)

if [[ "$FIRST_LINE" != "$CHECK_LICENSE" ]]
then
echo "$FILE :: missing license header \"$CHECK_LICENSE\""
RET_VAL=1
fi

if [[ "$SECOND_LINE" != "" ]]
then
echo "$FILE :: missing new line after license header"
RET_VAL=1
fi
done

exit $RET_VAL
85 changes: 0 additions & 85 deletions scripts/ci_test_target.sh

This file was deleted.

0 comments on commit 3221f46

Please sign in to comment.