mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Tools: Permanently ignore some header files from header check
This commit is contained in:
parent
3478745abc
commit
0c24913608
@ -205,6 +205,7 @@ requirements.txt @esp-idf-codeowners/tools
|
|||||||
|
|
||||||
# ignore lists
|
# ignore lists
|
||||||
/tools/ci/check_copyright_ignore.txt @esp-idf-codeowners/tools
|
/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-cmake_ignore.txt @esp-idf-codeowners/tools
|
||||||
/tools/ci/check_examples_cmake_make-make_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
|
/tools/ci/mypy_ignore_list.txt @esp-idf-codeowners/tools
|
||||||
|
@ -120,4 +120,4 @@ repos:
|
|||||||
rev: v4.0.1
|
rev: v4.0.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: file-contents-sorter
|
- 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)'
|
||||||
|
@ -16,6 +16,7 @@ Check files for copyright headers:
|
|||||||
"""
|
"""
|
||||||
import argparse
|
import argparse
|
||||||
import datetime
|
import datetime
|
||||||
|
import fnmatch
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
@ -28,6 +29,7 @@ from thefuzz import fuzz
|
|||||||
|
|
||||||
IDF_PATH = os.getenv('IDF_PATH', os.getcwd())
|
IDF_PATH = os.getenv('IDF_PATH', os.getcwd())
|
||||||
IGNORE_LIST_FN = os.path.join(IDF_PATH, 'tools/ci/check_copyright_ignore.txt')
|
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('''\
|
CHECK_FAIL_MESSAGE = textwrap.dedent('''\
|
||||||
To make a file, not on the ignore list to pass the test it needs to contain both:
|
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()]
|
ignore_list = [item.strip() for item in f.readlines()]
|
||||||
updated_ignore_list = ignore_list.copy()
|
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:
|
for file_name in args.filenames:
|
||||||
try:
|
try:
|
||||||
mime = get_file_mime(file_name)
|
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}')
|
print(f'{TERMINAL_GRAY}"{file_name}" is not of a supported type! Skipping.{TERMINAL_RESET}')
|
||||||
continue
|
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 file_name in ignore_list:
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
print(f'{TERMINAL_GRAY}"{file_name}" is on the ignore list.{TERMINAL_RESET}')
|
print(f'{TERMINAL_GRAY}"{file_name}" is on the ignore list.{TERMINAL_RESET}')
|
||||||
@ -425,6 +434,7 @@ def main() -> None:
|
|||||||
|
|
||||||
if args.debug:
|
if args.debug:
|
||||||
print(f'{TERMINAL_GRAY}Running with args: {args}')
|
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}')
|
print(f'Ignore list: {IGNORE_LIST_FN}{TERMINAL_RESET}')
|
||||||
|
|
||||||
wrong_header_files, modified_files = check_copyrights(args)
|
wrong_header_files, modified_files = check_copyrights(args)
|
||||||
|
9
tools/ci/check_copyright_permanent_ignore.txt
Normal file
9
tools/ci/check_copyright_permanent_ignore.txt
Normal file
@ -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/*
|
Loading…
x
Reference in New Issue
Block a user