Skip to content

Commit

Permalink
Add license check for move, typescript, javascript files (#1051)
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

1 comment on commit 95ed0a6

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bench results

�[0m�[0m�[1m�[32m Finished�[0m release [optimized] target(s) in 0.29s
�[0m�[0m�[1m�[32m Running�[0m target/release/bench
�[2m2022-03-24T22:52:35.240056Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Starting benchmark: TransactionsAndCerts
�[2m2022-03-24T22:52:35.240088Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Preparing accounts.
�[2m2022-03-24T22:52:35.240526Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Open database on path: "/tmp/DB_BB66C4CF424FF93FA6550618DF64AB1E990C9AAC"
�[2m2022-03-24T22:52:35.411590Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Init Authority.
�[2m2022-03-24T22:52:35.515042Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Generate empty store with Genesis.
�[2m2022-03-24T22:52:36.180140Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Preparing transactions.
�[2m2022-03-24T22:52:36.644118Z�[0m �[32m INFO�[0m �[2msui_network::transport�[0m�[2m:�[0m Listening to TCP traffic on 127.0.0.1:9555
�[2m2022-03-24T22:52:37.645486Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Number of TCP connections: 2
�[2m2022-03-24T22:52:37.645547Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Sending requests.
�[2m2022-03-24T22:52:37.646310Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m Sending TCP requests to 127.0.0.1:9555
�[2m2022-03-24T22:52:37.646322Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m Sending TCP requests to 127.0.0.1:9555
�[2m2022-03-24T22:52:39.838825Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m Done sending TCP requests to 127.0.0.1:9555
�[2m2022-03-24T22:52:39.878281Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m Done sending TCP requests to 127.0.0.1:9555
�[2m2022-03-24T22:52:39.878385Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Received 2000 responses.
�[2m2022-03-24T22:52:39.951662Z�[0m �[33m WARN�[0m �[2mbench�[0m�[2m:�[0m Completed benchmark for TransactionsAndCerts
Total time: 2232822us, items: 100000, tx/sec: 44786.373477151334

Please sign in to comment.