diff options
| author | David Marchand <[email protected]> | 2024-10-25 09:04:18 +0200 |
|---|---|---|
| committer | David Marchand <[email protected]> | 2024-10-30 10:35:10 +0100 |
| commit | 129f38c5b7ab4428ed94d088e3d3ef6a81807b55 (patch) | |
| tree | 6596404269e5725c21b5bb0394e2b16f7dd3f8a2 /devtools | |
| parent | 40e6cf97d3a785645f075bc40a051502f935881d (diff) | |
devtools: handle multiple pattern for skipping files
We may want to skip multiple patterns when forbidding use of some
expression.
Signed-off-by: David Marchand <[email protected]>
Acked-by: Hemant Agrawal <[email protected]>
Diffstat (limited to 'devtools')
| -rwxr-xr-x | devtools/check-forbidden-tokens.awk | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/devtools/check-forbidden-tokens.awk b/devtools/check-forbidden-tokens.awk index 59b1121090..28d32fc086 100755 --- a/devtools/check-forbidden-tokens.awk +++ b/devtools/check-forbidden-tokens.awk @@ -10,6 +10,7 @@ BEGIN { split(FOLDERS,deny_folders," "); split(EXPRESSIONS,deny_expr," "); + split(SKIP_FILES,skip_files," "); in_file=0; in_comment=0; count=0; @@ -56,14 +57,22 @@ BEGIN { } count = 0 for (i in deny_folders) { - re = "^\\+\\+\\+ b/" deny_folders[i]; - if ($0 ~ re) { - # Check only if the files are not part of SKIP_FILES - if (!(length(SKIP_FILES) && ($re ~ SKIP_FILES))) { - in_file = 1 - last_file = $0 + if (!($0 ~ "^\\+\\+\\+ b/" deny_folders[i])) { + continue + } + skip = 0 + for (j in skip_files) { + if (!($0 ~ "^\\+\\+\\+ b/" skip_files[j])) { + continue } + skip = 1 + break + } + if (skip == 0) { + in_file = 1 + last_file = $0 } + break } } END { |
