summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYiyu Lin <linyiyu1992@gmail.com>2023-01-13 15:51:32 +0800
committerGitHub <noreply@github.com>2023-01-13 16:51:32 +0900
commita00e432297d2ae119c8e1097aec74badc886f912 (patch)
tree7380b37245e889e97a8c7b1535a1e31fddb74738
parent5707a958ac2b44d573d50260b1d0d40887662011 (diff)
chore: add `copyright_checker` tool and add the missing copyright (#17285)
-rw-r--r--bench_util/benches/op_baseline.rs2
-rw-r--r--bench_util/benches/utf8.rs2
-rw-r--r--cli/bench/http/deno_http_flash_ops_spawn.js2
-rw-r--r--cli/bench/http/deno_http_flash_spawn.js2
-rw-r--r--cli/bench/http/deno_http_native_headers.js2
-rw-r--r--cli/bench/http/deno_http_ops.js2
-rw-r--r--cli/bench/http/node_reactdom_ssr.js2
-rw-r--r--cli/bench/napi/bench.js2
-rw-r--r--cli/bench/stdio/stdio.js3
-rw-r--r--cli/cache/parsed_source.rs2
-rw-r--r--cli/js.rs2
-rw-r--r--cli/lsp/client.rs2
-rw-r--r--cli/ops/bench.rs16
-rw-r--r--cli/tests/unit/abort_controller_test.ts2
-rw-r--r--cli/tests/unit/command_test.ts3
-rw-r--r--cli/tests/unit/dom_exception_test.ts2
-rw-r--r--cli/tests/unit/fs_events_test.ts3
-rw-r--r--cli/tests/unit/network_interfaces_test.ts2
-rw-r--r--cli/tests/unit/opcall_test.ts2
-rw-r--r--cli/tests/unit/path_from_url_test.ts2
-rw-r--r--cli/tests/unit/read_text_file_test.ts2
-rw-r--r--cli/tests/unit/ref_unref_test.ts2
-rw-r--r--cli/tests/unit/structured_clone_test.ts2
-rw-r--r--cli/tests/unit/version_test.ts2
-rw-r--r--cli/tests/unit/wasm_test.ts2
-rw-r--r--cli/tests/unit/webcrypto_test.ts2
-rw-r--r--cli/tests/unit/webgpu_test.ts2
-rw-r--r--cli/tests/unit/write_text_file_test.ts2
-rw-r--r--cli/tools/coverage/merge.rs3
-rw-r--r--cli/tools/coverage/range_tree.rs3
-rw-r--r--cli/util/console.rs2
-rw-r--r--cli/util/path.rs2
-rw-r--r--cli/worker.rs2
-rw-r--r--core/error_codes.rs2
-rw-r--r--core/snapshot_util.rs7
-rw-r--r--ext/broadcast_channel/in_memory_broadcast_channel.rs6
-rw-r--r--ext/crypto/decrypt.rs5
-rw-r--r--ext/crypto/ed25519.rs2
-rw-r--r--ext/crypto/encrypt.rs4
-rw-r--r--ext/crypto/export_key.rs5
-rw-r--r--ext/crypto/generate_key.rs5
-rw-r--r--ext/crypto/import_key.rs7
-rw-r--r--ext/crypto/shared.rs2
-rw-r--r--ext/crypto/x25519.rs2
-rw-r--r--ext/flash/chunked.rs3
-rw-r--r--ext/flash/sendfile.rs2
-rw-r--r--ext/flash/socket.rs15
-rw-r--r--ext/node/module_es_shim.js2
-rw-r--r--ext/node/path.rs2
-rw-r--r--ext/url/benches/url_ops.rs2
-rw-r--r--ext/url/urlpattern.rs2
-rw-r--r--ext/web/benches/encoding.rs3
-rw-r--r--ext/web/benches/timers_ops.rs3
-rw-r--r--ext/web/blob.rs15
-rw-r--r--ext/web/message_port.rs2
-rw-r--r--ops/fast_call.rs9
-rw-r--r--ops/optimizer.rs13
-rw-r--r--runtime/js/40_spawn.js2
-rw-r--r--runtime/ops/http.rs2
-rw-r--r--runtime/ops/spawn.rs2
-rw-r--r--serde_v8/magic/u16string.rs5
-rw-r--r--test_ffi/tests/event_loop_integration.ts2
-rw-r--r--test_napi/src/primitives.rs2
-rw-r--r--test_util/src/assertions.rs2
-rw-r--r--test_util/src/npm.rs2
-rw-r--r--test_util/src/pty.rs2
-rw-r--r--test_util/src/temp_dir.rs2
-rw-r--r--tools/README.md13
-rw-r--r--tools/copyright_checker.js84
69 files changed, 276 insertions, 49 deletions
diff --git a/bench_util/benches/op_baseline.rs b/bench_util/benches/op_baseline.rs
index 9c3ac16c4..f8ae32b35 100644
--- a/bench_util/benches/op_baseline.rs
+++ b/bench_util/benches/op_baseline.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use deno_bench_util::bench_or_profile;
use deno_bench_util::bencher::{benchmark_group, Bencher};
use deno_bench_util::{bench_js_async, bench_js_sync};
diff --git a/bench_util/benches/utf8.rs b/bench_util/benches/utf8.rs
index 363300d5e..2bbf439b6 100644
--- a/bench_util/benches/utf8.rs
+++ b/bench_util/benches/utf8.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use deno_bench_util::bench_js_sync_with;
use deno_bench_util::bench_or_profile;
use deno_bench_util::bencher::benchmark_group;
diff --git a/cli/bench/http/deno_http_flash_ops_spawn.js b/cli/bench/http/deno_http_flash_ops_spawn.js
index 6ee39a84a..b9d11462f 100644
--- a/cli/bench/http/deno_http_flash_ops_spawn.js
+++ b/cli/bench/http/deno_http_flash_ops_spawn.js
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
if (Deno.build.os !== "linux") {
throw new Error("SO_REUSEPORT is only supported on Linux");
}
diff --git a/cli/bench/http/deno_http_flash_spawn.js b/cli/bench/http/deno_http_flash_spawn.js
index eb827b34b..e47acffc5 100644
--- a/cli/bench/http/deno_http_flash_spawn.js
+++ b/cli/bench/http/deno_http_flash_spawn.js
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
if (Deno.build.os !== "linux") {
throw new Error("SO_REUSEPORT is only supported on Linux");
}
diff --git a/cli/bench/http/deno_http_native_headers.js b/cli/bench/http/deno_http_native_headers.js
index 23ef1e060..7c1eaa583 100644
--- a/cli/bench/http/deno_http_native_headers.js
+++ b/cli/bench/http/deno_http_native_headers.js
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
const addr = Deno.args[0] || "127.0.0.1:4500";
const [hostname, port] = addr.split(":");
const listener = Deno.listen({ hostname, port: Number(port) });
diff --git a/cli/bench/http/deno_http_ops.js b/cli/bench/http/deno_http_ops.js
index f65b32170..3fd0bef31 100644
--- a/cli/bench/http/deno_http_ops.js
+++ b/cli/bench/http/deno_http_ops.js
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
const addr = Deno.args[0] || "127.0.0.1:4500";
const [hostname, port] = addr.split(":");
const tcp = Deno.listen({ hostname, port: Number(port) });
diff --git a/cli/bench/http/node_reactdom_ssr.js b/cli/bench/http/node_reactdom_ssr.js
index 5e784b946..f82b504d7 100644
--- a/cli/bench/http/node_reactdom_ssr.js
+++ b/cli/bench/http/node_reactdom_ssr.js
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
var Gd = Object.create;
var Ac = Object.defineProperty;
var Xd = Object.getOwnPropertyDescriptor;
diff --git a/cli/bench/napi/bench.js b/cli/bench/napi/bench.js
index 5917d3a28..63215a217 100644
--- a/cli/bench/napi/bench.js
+++ b/cli/bench/napi/bench.js
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import { loadTestLibrary } from "../../../test_napi/common.js";
const lib = loadTestLibrary();
diff --git a/cli/bench/stdio/stdio.js b/cli/bench/stdio/stdio.js
index 1d11c273d..e53016df2 100644
--- a/cli/bench/stdio/stdio.js
+++ b/cli/bench/stdio/stdio.js
@@ -1,5 +1,6 @@
-// From https://github.com/just-js/benchmarks/tree/main/01-stdio
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+//
+// From https://github.com/just-js/benchmarks/tree/main/01-stdio
const blocksize = parseInt(Deno.args[0] || 65536);
const buf = new Uint8Array(blocksize);
diff --git a/cli/cache/parsed_source.rs b/cli/cache/parsed_source.rs
index 28547dcf6..cef33e354 100644
--- a/cli/cache/parsed_source.rs
+++ b/cli/cache/parsed_source.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use std::collections::HashMap;
use std::path::Path;
use std::path::PathBuf;
diff --git a/cli/js.rs b/cli/js.rs
index 4bf3da627..06a6a5fd9 100644
--- a/cli/js.rs
+++ b/cli/js.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use deno_core::Snapshot;
use log::debug;
use once_cell::sync::Lazy;
diff --git a/cli/lsp/client.rs b/cli/lsp/client.rs
index 25c97d9d5..b39678667 100644
--- a/cli/lsp/client.rs
+++ b/cli/lsp/client.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
diff --git a/cli/ops/bench.rs b/cli/ops/bench.rs
index 9b70cfa79..2181a139c 100644
--- a/cli/ops/bench.rs
+++ b/cli/ops/bench.rs
@@ -1,6 +1,9 @@
-use crate::tools::bench::BenchDescription;
-use crate::tools::bench::BenchEvent;
-use crate::tools::test::TestFilter;
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
+use std::sync::atomic::AtomicUsize;
+use std::sync::atomic::Ordering;
+use std::time;
+
use deno_core::error::generic_error;
use deno_core::error::AnyError;
use deno_core::op;
@@ -12,12 +15,13 @@ use deno_runtime::permissions::ChildPermissionsArg;
use deno_runtime::permissions::PermissionsContainer;
use serde::Deserialize;
use serde::Serialize;
-use std::sync::atomic::AtomicUsize;
-use std::sync::atomic::Ordering;
-use std::time;
use tokio::sync::mpsc::UnboundedSender;
use uuid::Uuid;
+use crate::tools::bench::BenchDescription;
+use crate::tools::bench::BenchEvent;
+use crate::tools::test::TestFilter;
+
pub fn init(
sender: UnboundedSender<BenchEvent>,
filter: TestFilter,
diff --git a/cli/tests/unit/abort_controller_test.ts b/cli/tests/unit/abort_controller_test.ts
index 6b7bea899..2df953773 100644
--- a/cli/tests/unit/abort_controller_test.ts
+++ b/cli/tests/unit/abort_controller_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import { assert, assertEquals } from "./test_util.ts";
Deno.test(function basicAbortController() {
diff --git a/cli/tests/unit/command_test.ts b/cli/tests/unit/command_test.ts
index 2a0562c93..e7f940535 100644
--- a/cli/tests/unit/command_test.ts
+++ b/cli/tests/unit/command_test.ts
@@ -1,4 +1,5 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import {
assert,
assertEquals,
diff --git a/cli/tests/unit/dom_exception_test.ts b/cli/tests/unit/dom_exception_test.ts
index b6b6a4440..d0a0b8a94 100644
--- a/cli/tests/unit/dom_exception_test.ts
+++ b/cli/tests/unit/dom_exception_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import {
assertEquals,
assertNotEquals,
diff --git a/cli/tests/unit/fs_events_test.ts b/cli/tests/unit/fs_events_test.ts
index 2888a05f8..cdfb67657 100644
--- a/cli/tests/unit/fs_events_test.ts
+++ b/cli/tests/unit/fs_events_test.ts
@@ -1,4 +1,5 @@
-// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import { assert, assertEquals, assertThrows, delay } from "./test_util.ts";
// TODO(ry) Add more tests to specify format.
diff --git a/cli/tests/unit/network_interfaces_test.ts b/cli/tests/unit/network_interfaces_test.ts
index a0e6e691a..287b7d421 100644
--- a/cli/tests/unit/network_interfaces_test.ts
+++ b/cli/tests/unit/network_interfaces_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import { assert } from "./test_util.ts";
Deno.test(
diff --git a/cli/tests/unit/opcall_test.ts b/cli/tests/unit/opcall_test.ts
index 970731855..61c3c8849 100644
--- a/cli/tests/unit/opcall_test.ts
+++ b/cli/tests/unit/opcall_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import { assert, assertStringIncludes, unreachable } from "./test_util.ts";
Deno.test(async function sendAsyncStackTrace() {
diff --git a/cli/tests/unit/path_from_url_test.ts b/cli/tests/unit/path_from_url_test.ts
index f375d84f4..9842c29c2 100644
--- a/cli/tests/unit/path_from_url_test.ts
+++ b/cli/tests/unit/path_from_url_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import { assertEquals, assertThrows } from "./test_util.ts";
// @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol
diff --git a/cli/tests/unit/read_text_file_test.ts b/cli/tests/unit/read_text_file_test.ts
index 5e455c583..e78276dde 100644
--- a/cli/tests/unit/read_text_file_test.ts
+++ b/cli/tests/unit/read_text_file_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import {
assert,
assertEquals,
diff --git a/cli/tests/unit/ref_unref_test.ts b/cli/tests/unit/ref_unref_test.ts
index da6e95efc..7ce72a170 100644
--- a/cli/tests/unit/ref_unref_test.ts
+++ b/cli/tests/unit/ref_unref_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import { assertNotEquals, execCode } from "./test_util.ts";
Deno.test("[unrefOp] unref'ing invalid ops does not have effects", async () => {
diff --git a/cli/tests/unit/structured_clone_test.ts b/cli/tests/unit/structured_clone_test.ts
index c60b38a8a..722c9c8cc 100644
--- a/cli/tests/unit/structured_clone_test.ts
+++ b/cli/tests/unit/structured_clone_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import { assert, assertEquals, assertThrows } from "./test_util.ts";
// Basic tests for the structured clone algorithm. Mainly tests TypeScript
diff --git a/cli/tests/unit/version_test.ts b/cli/tests/unit/version_test.ts
index 3b371a2bc..55a4bc6c9 100644
--- a/cli/tests/unit/version_test.ts
+++ b/cli/tests/unit/version_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import { assert, assertEquals } from "./test_util.ts";
Deno.test(function version() {
diff --git a/cli/tests/unit/wasm_test.ts b/cli/tests/unit/wasm_test.ts
index 03ed0e298..73d243de8 100644
--- a/cli/tests/unit/wasm_test.ts
+++ b/cli/tests/unit/wasm_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import { assert, assertEquals, assertRejects } from "./test_util.ts";
// The following blob can be created by taking the following s-expr and pass
diff --git a/cli/tests/unit/webcrypto_test.ts b/cli/tests/unit/webcrypto_test.ts
index 86d9f38ab..c522bf1e6 100644
--- a/cli/tests/unit/webcrypto_test.ts
+++ b/cli/tests/unit/webcrypto_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import {
assert,
assertEquals,
diff --git a/cli/tests/unit/webgpu_test.ts b/cli/tests/unit/webgpu_test.ts
index c903736f8..decceb0f9 100644
--- a/cli/tests/unit/webgpu_test.ts
+++ b/cli/tests/unit/webgpu_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import { assert, assertEquals } from "./test_util.ts";
let isCI: boolean;
diff --git a/cli/tests/unit/write_text_file_test.ts b/cli/tests/unit/write_text_file_test.ts
index ee9cac177..ce179ab99 100644
--- a/cli/tests/unit/write_text_file_test.ts
+++ b/cli/tests/unit/write_text_file_test.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
import {
assert,
assertEquals,
diff --git a/cli/tools/coverage/merge.rs b/cli/tools/coverage/merge.rs
index 7fe382d24..29d26da3c 100644
--- a/cli/tools/coverage/merge.rs
+++ b/cli/tools/coverage/merge.rs
@@ -1,6 +1,7 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+//
// Forked from https://github.com/demurgos/v8-coverage/tree/d0ca18da8740198681e0bc68971b0a6cdb11db3e/rust
// Copyright 2021 Charles Samborski. All rights reserved. MIT license.
-// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use super::json_types::CoverageRange;
use super::json_types::FunctionCoverage;
diff --git a/cli/tools/coverage/range_tree.rs b/cli/tools/coverage/range_tree.rs
index 19b3257f8..8b3d36cd8 100644
--- a/cli/tools/coverage/range_tree.rs
+++ b/cli/tools/coverage/range_tree.rs
@@ -1,6 +1,7 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+//
// Forked from https://github.com/demurgos/v8-coverage/tree/d0ca18da8740198681e0bc68971b0a6cdb11db3e/rust
// Copyright 2021 Charles Samborski. All rights reserved. MIT license.
-// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use super::json_types::CoverageRange;
use std::iter::Peekable;
diff --git a/cli/util/console.rs b/cli/util/console.rs
index c36b274db..ac78ca4df 100644
--- a/cli/util/console.rs
+++ b/cli/util/console.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use deno_runtime::ops::tty::ConsoleSize;
/// Gets the console size.
diff --git a/cli/util/path.rs b/cli/util/path.rs
index 6df982f4e..76e2a1b6f 100644
--- a/cli/util/path.rs
+++ b/cli/util/path.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use std::borrow::Cow;
use std::path::Path;
use std::path::PathBuf;
diff --git a/cli/worker.rs b/cli/worker.rs
index 2f8a9b687..7e0616650 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use std::path::PathBuf;
use std::rc::Rc;
use std::sync::Arc;
diff --git a/core/error_codes.rs b/core/error_codes.rs
index 6a8dd9fa3..874aa4ec6 100644
--- a/core/error_codes.rs
+++ b/core/error_codes.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use anyhow::Error;
pub fn get_error_code(err: &Error) -> Option<&'static str> {
diff --git a/core/snapshot_util.rs b/core/snapshot_util.rs
index bacc0c6ae..b35cabbfa 100644
--- a/core/snapshot_util.rs
+++ b/core/snapshot_util.rs
@@ -1,9 +1,12 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
+use std::path::Path;
+use std::path::PathBuf;
+
use crate::Extension;
use crate::JsRuntime;
use crate::RuntimeOptions;
use crate::Snapshot;
-use std::path::Path;
-use std::path::PathBuf;
pub type CompressionCb = dyn Fn(&mut Vec<u8>, &[u8]);
diff --git a/ext/broadcast_channel/in_memory_broadcast_channel.rs b/ext/broadcast_channel/in_memory_broadcast_channel.rs
index 595a7cc13..7c9c68ae0 100644
--- a/ext/broadcast_channel/in_memory_broadcast_channel.rs
+++ b/ext/broadcast_channel/in_memory_broadcast_channel.rs
@@ -1,14 +1,16 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-use crate::BroadcastChannel;
+use std::sync::Arc;
+
use async_trait::async_trait;
use deno_core::error::AnyError;
use deno_core::parking_lot::Mutex;
-use std::sync::Arc;
use tokio::sync::broadcast;
use tokio::sync::mpsc;
use uuid::Uuid;
+use crate::BroadcastChannel;
+
#[derive(Clone)]
pub struct InMemoryBroadcastChannel(Arc<Mutex<broadcast::Sender<Message>>>);
diff --git a/ext/crypto/decrypt.rs b/ext/crypto/decrypt.rs
index c83ff55bd..6c4d5b6ba 100644
--- a/ext/crypto/decrypt.rs
+++ b/ext/crypto/decrypt.rs
@@ -1,4 +1,5 @@
-use crate::shared::*;
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use aes::cipher::block_padding::Pkcs7;
use aes::cipher::BlockDecryptMut;
use aes::cipher::KeyIvInit;
@@ -29,6 +30,8 @@ use sha2::Sha256;
use sha2::Sha384;
use sha2::Sha512;
+use crate::shared::*;
+
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DecryptOptions {
diff --git a/ext/crypto/ed25519.rs b/ext/crypto/ed25519.rs
index b7ff99d8b..898366bbc 100644
--- a/ext/crypto/ed25519.rs
+++ b/ext/crypto/ed25519.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use deno_core::error::AnyError;
use deno_core::op;
use deno_core::ZeroCopyBuf;
diff --git a/ext/crypto/encrypt.rs b/ext/crypto/encrypt.rs
index 9420acdbd..f34e0cbc6 100644
--- a/ext/crypto/encrypt.rs
+++ b/ext/crypto/encrypt.rs
@@ -1,4 +1,4 @@
-use crate::shared::*;
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use aes::cipher::block_padding::Pkcs7;
use aes::cipher::BlockEncryptMut;
@@ -31,6 +31,8 @@ use sha2::Sha256;
use sha2::Sha384;
use sha2::Sha512;
+use crate::shared::*;
+
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EncryptOptions {
diff --git a/ext/crypto/export_key.rs b/ext/crypto/export_key.rs
index 0cbb2f676..ec76bac92 100644
--- a/ext/crypto/export_key.rs
+++ b/ext/crypto/export_key.rs
@@ -1,4 +1,5 @@
-use crate::shared::*;
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use const_oid::AssociatedOid;
use const_oid::ObjectIdentifier;
use deno_core::error::custom_error;
@@ -15,6 +16,8 @@ use spki::der::Decode;
use spki::der::Encode;
use spki::AlgorithmIdentifier;
+use crate::shared::*;
+
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ExportKeyOptions {
diff --git a/ext/crypto/generate_key.rs b/ext/crypto/generate_key.rs
index 9ecbb8d11..2a9452c43 100644
--- a/ext/crypto/generate_key.rs
+++ b/ext/crypto/generate_key.rs
@@ -1,4 +1,5 @@
-use crate::shared::*;
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use deno_core::error::AnyError;
use deno_core::op;
use deno_core::ZeroCopyBuf;
@@ -12,6 +13,8 @@ use rsa::BigUint;
use rsa::RsaPrivateKey;
use serde::Deserialize;
+use crate::shared::*;
+
// Allowlist for RSA public exponents.
static PUB_EXPONENT_1: Lazy<BigUint> =
Lazy::new(|| BigUint::from_u64(3).unwrap());
diff --git a/ext/crypto/import_key.rs b/ext/crypto/import_key.rs
index 07c7f3f6f..42eab0e6c 100644
--- a/ext/crypto/import_key.rs
+++ b/ext/crypto/import_key.rs
@@ -1,5 +1,5 @@
-use crate::key::CryptoNamedCurve;
-use crate::shared::*;
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use deno_core::error::AnyError;
use deno_core::op;
use deno_core::ZeroCopyBuf;
@@ -12,6 +12,9 @@ use serde::Serialize;
use spki::der::Decode;
use spki::der::Encode;
+use crate::key::CryptoNamedCurve;
+use crate::shared::*;
+
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum KeyData {
diff --git a/ext/crypto/shared.rs b/ext/crypto/shared.rs
index d2f7d53e8..4ecb35dc2 100644
--- a/ext/crypto/shared.rs
+++ b/ext/crypto/shared.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use std::borrow::Cow;
use deno_core::error::custom_error;
diff --git a/ext/crypto/x25519.rs b/ext/crypto/x25519.rs
index 1e64e9909..0ecdf4ddc 100644
--- a/ext/crypto/x25519.rs
+++ b/ext/crypto/x25519.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use curve25519_dalek::montgomery::MontgomeryPoint;
use deno_core::error::AnyError;
use deno_core::op;
diff --git a/ext/flash/chunked.rs b/ext/flash/chunked.rs
index d414f211e..711dd717d 100644
--- a/ext/flash/chunked.rs
+++ b/ext/flash/chunked.rs
@@ -1,7 +1,8 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+//
// Based on https://github.com/frewsxcv/rust-chunked-transfer/blob/5c08614458580f9e7a85124021006d83ce1ed6e9/src/decoder.rs
// Copyright 2015 The tiny-http Contributors
// Copyright 2015 The rust-chunked-transfer Contributors
-// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use std::error::Error;
use std::fmt;
diff --git a/ext/flash/sendfile.rs b/ext/flash/sendfile.rs
index 43b5323a4..92e8f2bb7 100644
--- a/ext/flash/sendfile.rs
+++ b/ext/flash/sendfile.rs
@@ -1,5 +1,5 @@
-// Forked from https://github.com/Thomasdezeeuw/sendfile/blob/024f82cd4dede9048392a5bd6d8afcd4d5aa83d5/src/lib.rs
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+// Forked from https://github.com/Thomasdezeeuw/sendfile/blob/024f82cd4dede9048392a5bd6d8afcd4d5aa83d5/src/lib.rs
use std::future::Future;
use std::io;
diff --git a/ext/flash/socket.rs b/ext/flash/socket.rs
index 8256be8a0..77881d536 100644
--- a/ext/flash/socket.rs
+++ b/ext/flash/socket.rs
@@ -1,12 +1,13 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
+use std::cell::UnsafeCell;
+use std::future::Future;
+use std::io::{Read, Write};
+use std::pin::Pin;
+use std::sync::{Arc, Mutex};
+
use deno_core::error::AnyError;
use mio::net::TcpStream;
-use std::{
- cell::UnsafeCell,
- future::Future,
- io::{Read, Write},
- pin::Pin,
- sync::{Arc, Mutex},
-};
use tokio::sync::mpsc;
use crate::ParseStatus;
diff --git a/ext/node/module_es_shim.js b/ext/node/module_es_shim.js
index 164e18db5..f32006b4a 100644
--- a/ext/node/module_es_shim.js
+++ b/ext/node/module_es_shim.js
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
const m = Deno[Deno.internal].require.Module;
export const _cache = m._cache;
export const _extensions = m._extensions;
diff --git a/ext/node/path.rs b/ext/node/path.rs
index 8477fe713..f0ce52002 100644
--- a/ext/node/path.rs
+++ b/ext/node/path.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use std::path::Component;
use std::path::PathBuf;
diff --git a/ext/url/benches/url_ops.rs b/ext/url/benches/url_ops.rs
index 63810733d..2bf113f54 100644
--- a/ext/url/benches/url_ops.rs
+++ b/ext/url/benches/url_ops.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use deno_bench_util::bench_js_sync;
use deno_bench_util::bench_or_profile;
use deno_bench_util::bencher::{benchmark_group, Bencher};
diff --git a/ext/url/urlpattern.rs b/ext/url/urlpattern.rs
index 99fd21664..dcb3eaac8 100644
--- a/ext/url/urlpattern.rs
+++ b/ext/url/urlpattern.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use deno_core::error::type_error;
use deno_core::error::AnyError;
use deno_core::op;
diff --git a/ext/web/benches/encoding.rs b/ext/web/benches/encoding.rs
index 8c9eaeb6c..01fba9e66 100644
--- a/ext/web/benches/encoding.rs
+++ b/ext/web/benches/encoding.rs
@@ -1,8 +1,9 @@
-use deno_core::Extension;
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use deno_bench_util::bench_js_sync;
use deno_bench_util::bench_or_profile;
use deno_bench_util::bencher::{benchmark_group, Bencher};
+use deno_core::Extension;
use deno_web::BlobStore;
struct Permissions;
diff --git a/ext/web/benches/timers_ops.rs b/ext/web/benches/timers_ops.rs
index 2ba93c5e1..024d52360 100644
--- a/ext/web/benches/timers_ops.rs
+++ b/ext/web/benches/timers_ops.rs
@@ -1,8 +1,9 @@
-use deno_core::Extension;
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use deno_bench_util::bench_js_async;
use deno_bench_util::bench_or_profile;
use deno_bench_util::bencher::{benchmark_group, Bencher};
+use deno_core::Extension;
use deno_web::BlobStore;
struct Permissions;
diff --git a/ext/web/blob.rs b/ext/web/blob.rs
index 24cd13454..e4ba93a2f 100644
--- a/ext/web/blob.rs
+++ b/ext/web/blob.rs
@@ -1,18 +1,19 @@
-use async_trait::async_trait;
-use deno_core::error::type_error;
-use deno_core::op;
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-use deno_core::parking_lot::Mutex;
-use deno_core::url::Url;
-use deno_core::ZeroCopyBuf;
-use serde::{Deserialize, Serialize};
use std::cell::RefCell;
use std::collections::HashMap;
use std::fmt::Debug;
use std::rc::Rc;
use std::sync::Arc;
+use async_trait::async_trait;
+use deno_core::error::type_error;
use deno_core::error::AnyError;
+use deno_core::op;
+use deno_core::parking_lot::Mutex;
+use deno_core::url::Url;
+use deno_core::ZeroCopyBuf;
+use serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::Location;
diff --git a/ext/web/message_port.rs b/ext/web/message_port.rs
index 48c899216..f287fc82d 100644
--- a/ext/web/message_port.rs
+++ b/ext/web/message_port.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use std::borrow::Cow;
use std::cell::RefCell;
use std::rc::Rc;
diff --git a/ops/fast_call.rs b/ops/fast_call.rs
index f2ed8cb2d..b8fdf91bf 100644
--- a/ops/fast_call.rs
+++ b/ops/fast_call.rs
@@ -1,6 +1,6 @@
-/// Code generation for V8 fast calls.
-use crate::optimizer::FastValue;
-use crate::optimizer::Optimizer;
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+//! Code generation for V8 fast calls.
+
use pmutil::{q, Quote, ToTokensExt};
use proc_macro2::{Span, TokenStream};
use quote::quote;
@@ -9,6 +9,9 @@ use syn::{
Ident, ItemFn, ItemImpl, Path, PathArguments, PathSegment, Type, TypePath,
};
+use crate::optimizer::FastValue;
+use crate::optimizer::Optimizer;
+
pub(crate) struct FastImplItems {
pub(crate) impl_and_fn: TokenStream,
pub(crate) decl: TokenStream,
diff --git a/ops/optimizer.rs b/ops/optimizer.rs
index 2d68a296f..3f22a867b 100644
--- a/ops/optimizer.rs
+++ b/ops/optimizer.rs
@@ -1,10 +1,13 @@
-/// Optimizer for #[op]
-use crate::Op;
-use pmutil::{q, Quote};
-use proc_macro2::TokenStream;
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+//! Optimizer for #[op]
+
use std::collections::BTreeMap;
use std::fmt::Debug;
use std::fmt::Formatter;
+
+use pmutil::{q, Quote};
+use proc_macro2::TokenStream;
+
use syn::{
parse_quote, punctuated::Punctuated, token::Colon2,
AngleBracketedGenericArguments, FnArg, GenericArgument, PatType, Path,
@@ -12,6 +15,8 @@ use syn::{
TypeReference, TypeSlice, TypeTuple,
};
+use crate::Op;
+
#[derive(Debug)]
pub(crate) enum BailoutReason {
// Recoverable errors
diff --git a/runtime/js/40_spawn.js b/runtime/js/40_spawn.js
index 9d4aa3e9f..de733d7eb 100644
--- a/runtime/js/40_spawn.js
+++ b/runtime/js/40_spawn.js
@@ -1,4 +1,4 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
"use strict";
((window) => {
diff --git a/runtime/ops/http.rs b/runtime/ops/http.rs
index a531deb84..51562589e 100644
--- a/runtime/ops/http.rs
+++ b/runtime/ops/http.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use std::cell::RefCell;
use std::rc::Rc;
diff --git a/runtime/ops/spawn.rs b/runtime/ops/spawn.rs
index f552e9690..e5bf10cf0 100644
--- a/runtime/ops/spawn.rs
+++ b/runtime/ops/spawn.rs
@@ -1,4 +1,4 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use super::io::ChildStderrResource;
use super::io::ChildStdinResource;
diff --git a/serde_v8/magic/u16string.rs b/serde_v8/magic/u16string.rs
index 22868ccfb..11554738a 100644
--- a/serde_v8/magic/u16string.rs
+++ b/serde_v8/magic/u16string.rs
@@ -1,6 +1,9 @@
-use super::transl8::{impl_magic, impl_wrapper, FromV8, ToV8};
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use crate::Error;
+use super::transl8::{impl_magic, impl_wrapper, FromV8, ToV8};
+
impl_wrapper!(
pub struct U16String(Vec<u16>);
);
diff --git a/test_ffi/tests/event_loop_integration.ts b/test_ffi/tests/event_loop_integration.ts
index c3b34cc8f..e44c66ab6 100644
--- a/test_ffi/tests/event_loop_integration.ts
+++ b/test_ffi/tests/event_loop_integration.ts
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
const targetDir = Deno.execPath().replace(/[^\/\\]+$/, "");
const [libPrefix, libSuffix] = {
darwin: ["lib", "dylib"],
diff --git a/test_napi/src/primitives.rs b/test_napi/src/primitives.rs
index 2d951ebfa..e29c7c368 100644
--- a/test_napi/src/primitives.rs
+++ b/test_napi/src/primitives.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use crate::assert_napi_ok;
use crate::napi_new_property;
use napi_sys::*;
diff --git a/test_util/src/assertions.rs b/test_util/src/assertions.rs
index ecee14b1f..a004530b6 100644
--- a/test_util/src/assertions.rs
+++ b/test_util/src/assertions.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
#[macro_export]
macro_rules! assert_ends_with {
($left:expr, $right:expr $(,)?) => {
diff --git a/test_util/src/npm.rs b/test_util/src/npm.rs
index 6e393d835..738a1090a 100644
--- a/test_util/src/npm.rs
+++ b/test_util/src/npm.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use std::collections::HashMap;
use std::fs;
diff --git a/test_util/src/pty.rs b/test_util/src/pty.rs
index 4970e08f4..b2d7201ae 100644
--- a/test_util/src/pty.rs
+++ b/test_util/src/pty.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use std::collections::HashMap;
use std::io::Read;
use std::path::Path;
diff --git a/test_util/src/temp_dir.rs b/test_util/src/temp_dir.rs
index cab55cc14..01dce8f1a 100644
--- a/test_util/src/temp_dir.rs
+++ b/test_util/src/temp_dir.rs
@@ -1,3 +1,5 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
use std::fs;
use std::path::Path;
use std::path::PathBuf;
diff --git a/tools/README.md b/tools/README.md
index 59860ca1b..e88f8d892 100644
--- a/tools/README.md
+++ b/tools/README.md
@@ -72,3 +72,16 @@ on top, somewhat similar to `git subtree`.
2. Run `./tools/wgpu_sync.js`
3. Double check changes, possibly patch
4. Commit & send a PR with the updates
+
+## copyright_checker.js
+
+`copyright_checker.js` is used to check copyright headers in the codebase.
+
+To run the _copyright checker_:
+
+```sh
+deno run --allow-read --allow-run --unstable ./tools/copyright_checker.js
+```
+
+Then it will check all code files in the repository and report any files that
+are not properly licensed.
diff --git a/tools/copyright_checker.js b/tools/copyright_checker.js
new file mode 100644
index 000000000..706f59dbd
--- /dev/null
+++ b/tools/copyright_checker.js
@@ -0,0 +1,84 @@
+#!/usr/bin/env -S deno run --unstable --allow-read --allow-run
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
+import { getSources, ROOT_PATH } from "./util.js";
+
+const buffer = new Uint8Array(1024);
+const textDecoder = new TextDecoder();
+
+async function readFirstPartOfFile(filePath) {
+ const file = await Deno.open(filePath, { read: true });
+ try {
+ const byteCount = await file.read(buffer);
+ return textDecoder.decode(buffer.slice(0, byteCount ?? 0));
+ } finally {
+ file.close();
+ }
+}
+
+async function checkCopyright() {
+ const sourceFiles = await getSources(ROOT_PATH, [
+ // js and ts
+ "*.js",
+ "*.ts",
+ ":!:.github/mtime_cache/action.js",
+ ":!:cli/tests/testdata/**",
+ ":!:cli/bench/testdata/**",
+ ":!:cli/tsc/dts/**",
+ ":!:cli/tsc/*typescript.js",
+ ":!:cli/tsc/compiler.d.ts",
+ ":!:test_util/wpt/**",
+ ":!:tools/**", // these files are starts with `#!/usr/bin/env`
+ ":!:cli/tools/init/templates/**",
+
+ // rust
+ "*.rs",
+ ":!:ops/optimizer_tests/**",
+
+ // toml
+ "*Cargo.toml",
+ ]);
+
+ let totalCount = 0;
+ const sourceFilesSet = new Set(sourceFiles);
+
+ for (const file of sourceFilesSet) {
+ const ERROR_MSG = "Copyright header is missing: ";
+
+ const fileText = await readFirstPartOfFile(file);
+ if (file.endsWith("Cargo.toml")) {
+ if (
+ !fileText.startsWith(
+ "# Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.",
+ )
+ ) {
+ console.log(ERROR_MSG + file);
+ totalCount += 1;
+ }
+ continue;
+ }
+
+ if (
+ !fileText.startsWith(
+ "// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.",
+ )
+ ) {
+ console.log(ERROR_MSG + file);
+ totalCount += 1;
+ }
+ }
+
+ console.log("\nTotal errors: " + totalCount);
+
+ if (totalCount > 0) {
+ Deno.exit(1);
+ }
+}
+
+async function main() {
+ await Deno.chdir(ROOT_PATH);
+
+ await checkCopyright();
+}
+
+await main();