This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#3] Add script to check existance of license header
- Loading branch information
Showing
3 changed files
with
27 additions
and
85 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.