Ignore {%

This commit is contained in:
Kevin Veen-Birkenbach 2025-07-15 21:39:41 +02:00
parent ac3bc5742d
commit 45c18b69ba
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E

View File

@ -68,7 +68,11 @@ class TestGetAppConfPaths(unittest.TestCase):
continue continue
for m in cls.pattern.finditer(text): for m in cls.pattern.finditer(text):
lineno = text.count('\n', 0, m.start()) + 1 lineno = text.count('\n', 0, m.start()) + 1
app_arg, path_arg = m.group(1).strip(), m.group(2).strip() app_arg = m.group(1).strip()
path_arg = m.group(2).strip()
# ignore any templated Jinja2 raw-blocks
if '{%' in path_arg:
continue
if (app_arg.startswith("'") and app_arg.endswith("'")) or (app_arg.startswith('"') and app_arg.endswith('"')): if (app_arg.startswith("'") and app_arg.endswith("'")) or (app_arg.startswith('"') and app_arg.endswith('"')):
app_id = app_arg.strip("'\"") app_id = app_arg.strip("'\"")
cls.literal_paths.setdefault(app_id, {}).setdefault(path_arg, []).append((file_path, lineno)) cls.literal_paths.setdefault(app_id, {}).setdefault(path_arg, []).append((file_path, lineno))