Commit f6bfa053 authored by David Foucher's avatar David Foucher

Add possibility to add a comment bloc in end of a rule file

To add a comment to the rule file, define the comment bloc start the
bloc by adding "---" and next line will be consider as comment bloc
Only on comment bloc can be create and must be at the end of the file.
parent 65e9ab03
Pipeline #2631 failed with stage
in 1 minute and 11 seconds
......@@ -114,7 +114,9 @@ def load_authorisations(data):
def load_rules(path):
with path.open() as rules_file:
data = rules_file.read()
datas = rules_file.read().split('---\n', 1)
data = datas[0]
comment = data[1] if len(data) == 2 else ''
# Don't use local path in rule id, so we can call it from a Pointer
# value.
id_ = path.name
......@@ -124,6 +126,7 @@ def load_rules(path):
"data": data,
"path": str(path.relative_to(ROOT / "rules")),
"name": path.stem,
"comment": comment,
}
try:
return id_, Rule.load(data.splitlines(), id_)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment