Merge branch 'bugfix/header_ignore' into 'master'

Tools: Permanently ignore some files from header check

See merge request espressif/esp-idf!15559
pull/7751/head
Roland Dobai 2021-10-20 07:36:16 +00:00
commit f6c1684664
4 zmienionych plików z 21 dodań i 1 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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)'

Wyświetl plik

@ -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)

Wyświetl plik

@ -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/*