[PATCH v2 1/6] devtools: handle multiple pattern for skipping files
David Marchand
david.marchand at redhat.com
Fri Oct 25 09:04:18 CEST 2024
We may want to skip multiple patterns when forbidding use of some
expression.
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
devtools/check-forbidden-tokens.awk | 21 +++++++++++++++------
1 file 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 {
--
2.46.2
More information about the dev
mailing list