diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index 2f0f308768..f6b493bec1 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -205,6 +205,7 @@ requirements.txt @esp-idf-codeowners/tools # ignore lists /tools/ci/check_copyright_ignore.txt @esp-idf-codeowners/tools +/tools/ci/check_copyright_permanent_ignore.txt @esp-idf-codeowners/all-maintainers /tools/ci/check_examples_cmake_make-cmake_ignore.txt @esp-idf-codeowners/tools /tools/ci/check_examples_cmake_make-make_ignore.txt @esp-idf-codeowners/tools /tools/ci/mypy_ignore_list.txt @esp-idf-codeowners/tools diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6519087baf..cc0b4c9b45 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -120,4 +120,4 @@ repos: rev: v4.0.1 hooks: - id: file-contents-sorter - files: 'tools\/ci\/(executable-list\.txt|mypy_ignore_list\.txt|check_copyright_ignore\.txt)' + files: 'tools\/ci\/(executable-list\.txt|mypy_ignore_list\.txt|check_copyright_ignore\.txt|check_copyright_permanent_ignore\.txt)' diff --git a/tools/ci/check_copyright.py b/tools/ci/check_copyright.py index e5ef394bcb..2d91edf530 100755 --- a/tools/ci/check_copyright.py +++ b/tools/ci/check_copyright.py @@ -16,6 +16,7 @@ Check files for copyright headers: """ import argparse import datetime +import fnmatch import os import re import sys @@ -28,6 +29,7 @@ from thefuzz import fuzz IDF_PATH = os.getenv('IDF_PATH', os.getcwd()) IGNORE_LIST_FN = os.path.join(IDF_PATH, 'tools/ci/check_copyright_ignore.txt') +PERMANENT_IGNORE_LIST_FN = os.path.join(IDF_PATH, 'tools/ci/check_copyright_permanent_ignore.txt') CHECK_FAIL_MESSAGE = textwrap.dedent('''\ To make a file, not on the ignore list to pass the test it needs to contain both: @@ -361,6 +363,9 @@ def check_copyrights(args: argparse.Namespace) -> Tuple[List, List]: ignore_list = [item.strip() for item in f.readlines()] updated_ignore_list = ignore_list.copy() + with open(PERMANENT_IGNORE_LIST_FN) as f: + permanent_ignore_list = [item.strip() for item in f.readlines()] + for file_name in args.filenames: try: mime = get_file_mime(file_name) @@ -368,6 +373,10 @@ def check_copyrights(args: argparse.Namespace) -> Tuple[List, List]: print(f'{TERMINAL_GRAY}"{file_name}" is not of a supported type! Skipping.{TERMINAL_RESET}') continue + if any(fnmatch.fnmatch(file_name, pattern) for pattern in permanent_ignore_list): + print(f'{TERMINAL_YELLOW}"{file_name}" is ignored by a permanent pattern!{TERMINAL_RESET}') + continue + if file_name in ignore_list: if args.verbose: print(f'{TERMINAL_GRAY}"{file_name}" is on the ignore list.{TERMINAL_RESET}') @@ -425,6 +434,7 @@ def main() -> None: if args.debug: print(f'{TERMINAL_GRAY}Running with args: {args}') + print(f'Permanent ignore list: {PERMANENT_IGNORE_LIST_FN}') print(f'Ignore list: {IGNORE_LIST_FN}{TERMINAL_RESET}') wrong_header_files, modified_files = check_copyrights(args) diff --git a/tools/ci/check_copyright_permanent_ignore.txt b/tools/ci/check_copyright_permanent_ignore.txt new file mode 100644 index 0000000000..10d0e8ce60 --- /dev/null +++ b/tools/ci/check_copyright_permanent_ignore.txt @@ -0,0 +1,9 @@ +components/bt/common/osi/* +components/bt/host/bluedroid/bta/* +components/bt/host/bluedroid/common/* +components/bt/host/bluedroid/device/* +components/bt/host/bluedroid/external/* +components/bt/host/bluedroid/hci/* +components/bt/host/bluedroid/main/* +components/bt/host/bluedroid/stack/* +components/bt/host/nimble/nimble/*