Skip to content

Commit

Permalink
[lint] Update license requirement. Added 'Move contributors' license …
Browse files Browse the repository at this point in the history
…to all files (anza-xyz#120)

* [lint] Update license requirement

- Files must now have the Move Contributors license header
- Optionally, they can have the Diem Core Contributors header first

* fixup! [lint] Update license requirement
  • Loading branch information
tnowacki authored May 10, 2022
1 parent 3d80936 commit b6506fa
Show file tree
Hide file tree
Showing 660 changed files with 680 additions and 21 deletions.
1 change: 1 addition & 0 deletions .github/actions/slack-file/message_file_to_slack.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
# Copyright (c) The Diem Core Contributors
# Copyright (c) The Move Contributors
# SPDX-License-Identifier: Apache-2.0

function echoerr() {
Expand Down
1 change: 1 addition & 0 deletions devtools/x-core/src/core_config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use serde::{Deserialize, Serialize};
Expand Down
1 change: 1 addition & 0 deletions devtools/x-core/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use camino::{Utf8Path, Utf8PathBuf};
Expand Down
1 change: 1 addition & 0 deletions devtools/x-core/src/git.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::errors::*;
Expand Down
1 change: 1 addition & 0 deletions devtools/x-core/src/graph.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{Result, SystemError, WorkspaceSubsets, XCoreContext};
Expand Down
1 change: 1 addition & 0 deletions devtools/x-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{core_config::XCoreConfig, git::GitCli};
Expand Down
1 change: 1 addition & 0 deletions devtools/x-core/src/workspace_subset.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{core_config::SubsetConfig, Result, SystemError};
Expand Down
1 change: 1 addition & 0 deletions devtools/x-lint/src/content.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{prelude::*, LintContext};
Expand Down
1 change: 1 addition & 0 deletions devtools/x-lint/src/file_path.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{prelude::*, LintContext};
Expand Down
1 change: 1 addition & 0 deletions devtools/x-lint/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

//! Lint engine.
Expand Down
1 change: 1 addition & 0 deletions devtools/x-lint/src/package.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{prelude::*, LintContext};
Expand Down
1 change: 1 addition & 0 deletions devtools/x-lint/src/project.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{prelude::*, LintContext};
Expand Down
1 change: 1 addition & 0 deletions devtools/x-lint/src/runner.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{prelude::*, LintContext};
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/bench.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
cargo::{build_args::BuildArgs, selected_package::SelectedPackageArgs, CargoCommand},
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/cargo.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/cargo/build_args.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use clap::{ArgEnum, Parser};
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/cargo/selected_package.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{changed_since::changed_since_impl, context::XContext, Result};
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/changed_since.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{context::XContext, Result};
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/check.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/clippy.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{utils::project_root, Result};
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/diff_summary.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::context::XContext;
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/fix.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/fmt.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{cargo::Cargo, context::XContext, Result};
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/generate_summaries.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::context::XContext;
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/generate_workspace_hack.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{cargo::Cargo, context::XContext, Result};
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/installer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/lint/allowed_paths.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use anyhow::Context;
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/lint/determinator.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use anyhow::Context;
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/lint/guppy.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

//! Project and package linters that run queries on guppy.
Expand Down
42 changes: 21 additions & 21 deletions devtools/x/src/lint/license.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use x_lint::prelude::*;

static ALLOWED_LICENSE_HEADERS: &[&str] = &[
"Copyright (c) The Move Contributors\n\
SPDX-License-Identifier: Apache-2.0\n\
",
"Copyright (c) The Diem Core Contributors\n\
SPDX-License-Identifier: Apache-2.0\n\
",
"Copyright (c) The Move Contributors\n\
Copyright (c) The Diem Core Contributors\n\
SPDX-License-Identifier: Apache-2.0\n\
",
];
static DIEM_CORE_CONTRIBUTORS: &str = "Copyright (c) The Diem Core Contributors";
static MOVE_CONTRIBUTORS: &str = "Copyright (c) The Move Contributors";
static LICENSE_IDENTIFIER: &str = "SPDX-License-Identifier: Apache-2.0";

fn has_license<'a>(maybe_license: impl Iterator<Item = &'a str>) -> bool {
let maybe = maybe_license.collect::<Vec<_>>();
for allowed in ALLOWED_LICENSE_HEADERS {
if allowed.lines().eq(maybe.clone().into_iter()) {
return true;
fn has_license<'a>(mut lines: impl Iterator<Item = &'a str>) -> bool {
let first = match lines.next() {
Some(line) => line,
None => return false,
};
let maybe_move_line = if first == DIEM_CORE_CONTRIBUTORS {
match lines.next() {
Some(line) => line,
None => return false,
}
}
false
} else {
first
};
let maybe_license_identifier = match lines.next() {
Some(line) => line,
None => return false,
};
maybe_move_line == MOVE_CONTRIBUTORS && maybe_license_identifier == LICENSE_IDENTIFIER
}

#[derive(Copy, Clone, Debug)]
Expand Down Expand Up @@ -67,7 +69,6 @@ impl ContentLinter for LicenseHeader {
let maybe_license = content
.lines()
.skip_while(|line| line.is_empty())
.take(2)
.map(|s| s.trim_start_matches("// "));
!has_license(maybe_license)
}
Expand All @@ -76,7 +77,6 @@ impl ContentLinter for LicenseHeader {
.lines()
.skip_while(|line| line.starts_with("#!"))
.skip_while(|line| line.is_empty())
.take(2)
.map(|s| s.trim_start_matches("# "));
!has_license(maybe_license)
}
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/lint/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::context::XContext;
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/lint/toml.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use camino::Utf8Path;
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/lint/whitespace.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use anyhow::Context;
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/lint/workspace_classify.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::config::TestOnlyConfig;
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

#![forbid(unsafe_code)]
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/nextest.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/playground.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

//! Playground for arbitrary code.
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/tools.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{context::XContext, Result};
Expand Down
1 change: 1 addition & 0 deletions devtools/x/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::{config::CargoConfig, installer::install_cargo_component_if_needed, Result};
Expand Down
1 change: 1 addition & 0 deletions language/benchmarks/benches/vm_benches.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use criterion::{criterion_group, criterion_main, measurement::Measurement, Criterion};
Expand Down
1 change: 1 addition & 0 deletions language/benchmarks/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

#![forbid(unsafe_code)]
Expand Down
1 change: 1 addition & 0 deletions language/benchmarks/src/measurement.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use criterion::Criterion;
Expand Down
1 change: 1 addition & 0 deletions language/benchmarks/src/move_vm.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use criterion::{measurement::Measurement, Criterion};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
# Copyright (c) The Diem Core Contributors
# Copyright (c) The Move Contributors
# SPDX-License-Identifier: Apache-2.0

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use anyhow::Result;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

/// Converts a camel-case string to snake-case
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

#![forbid(unsafe_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use proc_macro::TokenStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

#[macro_use]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

//! Don't forget to run this benchmark with AES-NI enable.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

//! Wrapper structs for types that need [RustCrypto](https://github.com/RustCrypto)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

//! This module provides an API for the PureEdDSA signature scheme over the ed25519 twisted
Expand Down
Loading

0 comments on commit b6506fa

Please sign in to comment.