Skip to content

Commit

Permalink
Change copyright notice to multiline comment
Browse files Browse the repository at this point in the history
  • Loading branch information
wesselb committed Jul 29, 2024
1 parent 1ec608b commit 102b598
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 3 additions & 1 deletion aurora/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
4 changes: 3 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""


def test():
Expand Down
15 changes: 11 additions & 4 deletions tests/test_headers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""

from pathlib import Path

Expand All @@ -7,7 +9,10 @@
SKIP_FILES: set[str] = {"_version.py"}
"""set[str]: These files are not required to have a copyright notice."""

COPYRIGHT_NOTICE = "# Copyright (c) Microsoft Corporation. Licensed under the MIT license."
COPYRIGHT_NOTICE: list[str] = [
'"""',
"Copyright (c) Microsoft Corporation. Licensed under the MIT license.",
]


@pytest.mark.parametrize("python_file", Path(__file__).parents[1].rglob("**/*.py"))
Expand All @@ -18,5 +23,7 @@ def test_presence_of_copyright_header(python_file: Path) -> None:
with open(python_file) as f:
lines = list(f.read().splitlines())

if not lines or lines[0].strip() != COPYRIGHT_NOTICE:
raise AssertionError(f"The first line of `{python_file}` must be the copyright notice.")
contains_notice = len(lines) >= len(COPYRIGHT_NOTICE)
contains_notice &= all(x.strip() == y.strip() for x, y in zip(lines, COPYRIGHT_NOTICE))
if not contains_notice:
raise AssertionError(f"`{python_file}` must start with the copyright notice.")

0 comments on commit 102b598

Please sign in to comment.