forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add license check for move, typescript, javascript files (MystenLabs#…
- Loading branch information
Showing
5 changed files
with
20 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
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 |
---|---|---|
@@ -1,20 +1,21 @@ | ||
#!/bin/bash | ||
# shellcheck disable=SC2044 | ||
# shellcheck disable=SC2044,SC2086,SC2016 | ||
# This script checks each file starts with a license comment | ||
set -e | ||
set -o pipefail | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
TOPLEVEL="${DIR}/../" | ||
|
||
# Iterate over rust files not in the target directory | ||
for i in $(find "$TOPLEVEL" -path "$TOPLEVEL/target" -prune -o -iname "*.rs" -print) | ||
# Iterate over files in the repo that satisfy the following rules | ||
# 1. File extension is one of .(move | rs | tsx | ts | js) | ||
# 2. File directory is not '$TOPLEVEL/target' or "**/build" or "**/node_modules" | ||
for i in $(find $TOPLEVEL -type d \( -path '$TOPLEVEL/target' -o -name 'node_modules' -o -name 'build' \) -prune -o \( -iname '*.rs' -o -iname '*.move' -o -iname '*.tsx' -o -iname '*.ts' -o -iname '*.js' \) -print) | ||
do | ||
CNT=$(head -n3 "$i" | grep -oEe '// (Copyright \(c\) 2022, Mysten Labs, Inc.|SPDX-License-Identifier: Apache-2.0)' | wc -l) | ||
# echo "$i $CNT" | ||
CNT=$(head -n3 "$i" | grep -oEe '// (Copyright \(c\) 2022, Mysten Labs, Inc.|SPDX-License-Identifier: Apache-2.0)' | wc -l) || true | ||
if [ "$CNT" -lt 2 ] | ||
then | ||
echo "File $i has an incorrect license header" | ||
exit 1 | ||
echo "File $i has an incorrect license header" | ||
exit 1 | ||
fi | ||
done |
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