Skip to content

Commit

Permalink
Add license check for move, typescript, javascript files (MystenLabs#…
Browse files Browse the repository at this point in the history
  • Loading branch information
666lcz authored Mar 24, 2022
1 parent c8915bd commit 95ed0a6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
3 changes: 3 additions & 0 deletions explorer/client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

module.exports = {
extends: ['react-app', 'react-app/jest', 'prettier'],
rules: {
Expand Down
3 changes: 3 additions & 0 deletions explorer/client/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

const defaultTheme = require('tailwindcss/defaultTheme');

module.exports = {
Expand Down
3 changes: 3 additions & 0 deletions nft_mirror/oracle_server/src/sdk/gateway-generated-schema.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

/**
* This file was auto-generated by openapi-typescript.
* Do not make direct changes to the file.
Expand Down
15 changes: 8 additions & 7 deletions scripts/license_check.sh
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
3 changes: 3 additions & 0 deletions sui_programmability/examples/defi/tests/EscrowTests.move
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

#[test_only]
module DeFi::EscrowTests {
use Sui::ID::{Self, VersionedID};
Expand Down

0 comments on commit 95ed0a6

Please sign in to comment.