mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-07-17 22:14:25 +02:00
Ignore comment out paths
This commit is contained in:
parent
b6eb73dee4
commit
54490faca7
@ -67,6 +67,20 @@ class TestGetAppConfPaths(unittest.TestCase):
|
|||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
for m in cls.pattern.finditer(text):
|
for m in cls.pattern.finditer(text):
|
||||||
|
# Determine the start and end of the current line
|
||||||
|
start = text.rfind('\n', 0, m.start()) + 1
|
||||||
|
end = text.find('\n', start)
|
||||||
|
line = text[start:end] if end != -1 else text[start:]
|
||||||
|
|
||||||
|
# 1) Skip lines that are entirely commented out
|
||||||
|
if line.lstrip().startswith('#'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
# 2) Skip calls preceded by an inline comment
|
||||||
|
idx_call = line.find('get_app_conf')
|
||||||
|
idx_hash = line.find('#')
|
||||||
|
if 0 <= idx_hash < idx_call:
|
||||||
|
continue
|
||||||
lineno = text.count('\n', 0, m.start()) + 1
|
lineno = text.count('\n', 0, m.start()) + 1
|
||||||
app_arg = m.group(1).strip()
|
app_arg = m.group(1).strip()
|
||||||
path_arg = m.group(2).strip()
|
path_arg = m.group(2).strip()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user