forked from espressif/esp-idf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add pre-commit to cleanup ignore lists
- Loading branch information
Showing
10 changed files
with
73 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env python | ||
|
||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import glob | ||
import os | ||
import typing as t | ||
|
||
from idf_ci_utils import IDF_PATH | ||
|
||
|
||
def print_list(_list: t.Iterable[str], title: t.Optional[str] = None) -> None: | ||
if not _list: | ||
return | ||
|
||
if title: | ||
print(title) | ||
|
||
for i in _list: | ||
print('- ', i) | ||
|
||
|
||
if __name__ == '__main__': | ||
os.chdir(IDF_PATH) | ||
ignore_lists = set() | ||
ignore_lists.update(glob.glob('tools/ci/*.txt', recursive=True)) | ||
ignore_lists.remove('tools/ci/ignore_build_warnings.txt') | ||
ignore_lists.remove('tools/ci/check_ldgen_mapping_exceptions.txt') | ||
print_list(ignore_lists, 'Ignore lists:') | ||
|
||
updated_files = [] | ||
for f in ignore_lists: | ||
print('Checking file:', f) | ||
|
||
updated = False | ||
lines = [] | ||
with open(f) as fr: | ||
for line in map(str.strip, fr.readlines()): | ||
if line.startswith('#'): | ||
lines.append(line) | ||
continue | ||
|
||
if not line: | ||
lines.append(line) | ||
continue | ||
|
||
glob_pattern = line | ||
if not list(glob.glob(glob_pattern, recursive=True)): | ||
print(' - No match:', glob_pattern) | ||
updated = True | ||
else: | ||
lines.append(glob_pattern) | ||
lines.append('') | ||
|
||
if updated: | ||
updated_files.append(f) | ||
with open(f, 'w') as fw: | ||
fw.write('\n'.join(lines)) | ||
|
||
if updated_files: | ||
print_list(updated_files, 'Updated files:') | ||
exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters