Skip to content

Commit

Permalink
fix copyright headers and add a script to check (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
zsol authored Feb 1, 2022
1 parent c5b0735 commit c91655f
Show file tree
Hide file tree
Showing 53 changed files with 86 additions and 51 deletions.
30 changes: 30 additions & 0 deletions check_copyright.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

set -eu
EXITCODE=0
error() { echo "$1"; EXITCODE=1; }

EXCEPTION_PATTERNS=(
"^native/libcst/tests/fixtures/"
"^libcst/_add_slots\.py$"
"^libcst/tests/test_\(e2e\|fuzz\)\.py$"
"^libcst/_parser/base_parser\.py$"
"^libcst/_parser/parso/utils\.py$"
"^libcst/_parser/parso/pgen2/\(generator\|grammar_parser\)\.py$"
"^libcst/_parser/parso/python/\(py_token\|tokenize\)\.py$"
"^libcst/_parser/parso/tests/test_\(fstring\|tokenize\|utils\)\.py$"
)


while read filename; do \
if ! head -n 16 "$filename" | grep -q "Copyright (c) Meta Platforms, Inc. and affiliates."; then
error "Missing copyright in $filename"
fi
done < <( git ls-tree -r --name-only HEAD | grep "\(.py\|\.sh\|\.rs\)$" | \
grep -v "${EXCEPTION_PATTERNS[@]/#/-e}" )
exit $EXITCODE
2 changes: 1 addition & 1 deletion libcst/_nodes/tests/test_match.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/parso/python/token.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/py_whitespace_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/types/py_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/types/py_token.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/types/py_whitespace_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion libcst/codemod/visitors/_apply_type_annotations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2016-present, Meta Platforms, Inc.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2016-present, Meta Platforms, Inc.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/benches/parser_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/bin.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/codegen.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/expression.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/inflate_helpers.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/macros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/module.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/op.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/parser_config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/py_cached.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/statement.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/traits.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/whitespace.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/parser/errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/parser/grammar.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/parser/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/parser/numbers.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/py.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/core/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This implementation is Copyright (c) Meta Platforms, Inc. and its affiliates.
// This implementation is Copyright (c) Meta Platforms, Inc. and affiliates.
//
// CPython 3.10.0a5 and the original C code this is based on is
// Copyright (c) 2001-2021 Python Software Foundation; All Rights Reserved
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/core/string_types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This implementation is Copyright (c) Meta Platforms, Inc. and its affiliates.
// This implementation is Copyright (c) Meta Platforms, Inc. and affiliates.
//
// CPython 3.10.0a5 and the original C code this is based on is
// Copyright (c) 2001-2021 Python Software Foundation; All Rights Reserved
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/debug_utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/operators.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/text_position/char_width.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/text_position/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/whitespace_parser.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/tests/parser_roundtrip.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst_derive/src/codegen.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst_derive/src/inflate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst_derive/src/into_py.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst_derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
2 changes: 1 addition & 1 deletion native/libcst_derive/src/parenthesized_node.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
Expand Down
5 changes: 5 additions & 0 deletions native/roundtrip.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

PARSE=$(dirname $0)/target/release/parse

exec diff -u "$1" <($PARSE < "$1")
2 changes: 1 addition & 1 deletion stubs/libcst/native.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion stubs/libcst_native/parser_config.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion stubs/libcst_native/token_type.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion stubs/libcst_native/tokenize.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion stubs/libcst_native/whitespace_parser.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion stubs/libcst_native/whitespace_state.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Expand Down

0 comments on commit c91655f

Please sign in to comment.