From f1bd734498a6c3f0a4fb4caffd4e4b1005c04afd Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sat, 22 Jun 2024 20:49:16 +0200 Subject: [PATCH] fix: fix syntax issue in annotation parser (#725) --- .dictionary | 1 + ansibledoctor/annotation.py | 2 +- ansibledoctor/doc_parser.py | 2 +- docs/content/usage/configuration.md | 8 ++++++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.dictionary b/.dictionary index 939922c..8df7bca 100644 --- a/.dictionary +++ b/.dictionary @@ -10,3 +10,4 @@ ansible-.+ toc GPL-3.0 (P|p)re-(C|c)ommit +JSON diff --git a/ansibledoctor/annotation.py b/ansibledoctor/annotation.py index de6560b..4f7979d 100644 --- a/ansibledoctor/annotation.py +++ b/ansibledoctor/annotation.py @@ -119,7 +119,7 @@ class Annotation: if parts[2] not in multiline_char and parts[2].startswith("$"): source = parts[2].replace("$", "").strip() - content = self._str_to_json(key, source, rfile, num, line) + content = self._str_to_json(key, source, rfile, num) item.data[key][parts[1]] = content diff --git a/ansibledoctor/doc_parser.py b/ansibledoctor/doc_parser.py index 7f79fb1..382ad13 100644 --- a/ansibledoctor/doc_parser.py +++ b/ansibledoctor/doc_parser.py @@ -74,7 +74,7 @@ class Parser: tags = [] for task in raw: - task_tags = task.get("tags") + task_tags = task.get("tags", []) if isinstance(task_tags, str): task_tags = [task_tags] diff --git a/docs/content/usage/configuration.md b/docs/content/usage/configuration.md index e265af4..6a7a4df 100644 --- a/docs/content/usage/configuration.md +++ b/docs/content/usage/configuration.md @@ -127,11 +127,15 @@ options: ## Environment Variables +{{< hint type=note >}} +List configuration options need to be passed as JSON strings. +{{< /hint >}} + ```Shell ANSIBLE_DOCTOR_BASE_DIR= ANSIBLE_DOCTOR_DRY_RUN=False -ANSIBLE_DOCTOR_EXCLUDE_FILES= -ANSIBLE_DOCTOR_EXCLUDE_TAGS= +ANSIBLE_DOCTOR_EXCLUDE_FILES="['molecule/']" +ANSIBLE_DOCTOR_EXCLUDE_TAGS="[]" ANSIBLE_DOCTOR_ROLE__NAME= ANSIBLE_DOCTOR_ROLE__AUTODETECT=True