From 4a2cd09fe53d43b07c5a0f24d2e245486c278cae Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Wed, 11 Dec 2024 12:30:53 +0100 Subject: [PATCH 1/2] feat: add support for optional event warning for in-line annotation Add warning for openedx-events annotations so developers can include relevant information about the current event. As for now, these warnings have been used to indicate that the event at the time of implementation doesn't have for the event bus. --- .../contrib/config/openedx_events_annotations.yaml | 1 + code_annotations/contrib/sphinx/extensions/openedx_events.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/code_annotations/contrib/config/openedx_events_annotations.yaml b/code_annotations/contrib/config/openedx_events_annotations.yaml index 2c25ce0..af47b2c 100644 --- a/code_annotations/contrib/config/openedx_events_annotations.yaml +++ b/code_annotations/contrib/config/openedx_events_annotations.yaml @@ -12,6 +12,7 @@ annotations: - ".. event_description:": - ".. event_data:": - ".. event_key_field:": + - ".. event_warning:": extensions: python: - py diff --git a/code_annotations/contrib/sphinx/extensions/openedx_events.py b/code_annotations/contrib/sphinx/extensions/openedx_events.py index b8f839c..3256f35 100644 --- a/code_annotations/contrib/sphinx/extensions/openedx_events.py +++ b/code_annotations/contrib/sphinx/extensions/openedx_events.py @@ -118,6 +118,11 @@ def iter_nodes(self): f" {event['line_number']})" ) + if event.get(".. event_warning:") not in (None, "None", "n/a", "N/A"): + event_section += nodes.warning( + "", nodes.paragraph("", event[".. event_warning:"]), ids=[f"warning-{event_name}"] + ) + subject_header += event_section if domain_header: From 8e3b6c9da2c8d8f54ed3b79f7a735ee1de054b44 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 12 Dec 2024 16:52:19 +0100 Subject: [PATCH 2/2] docs: add reference to in-line code annotations --- code_annotations/contrib/config/openedx_events_annotations.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code_annotations/contrib/config/openedx_events_annotations.yaml b/code_annotations/contrib/config/openedx_events_annotations.yaml index af47b2c..17a3d30 100644 --- a/code_annotations/contrib/config/openedx_events_annotations.yaml +++ b/code_annotations/contrib/config/openedx_events_annotations.yaml @@ -6,7 +6,7 @@ safelist_path: .annotation_safe_list.yml coverage_target: 100.0 annotations: feature_toggle: - # See annotation format documentation: https://edx-toggles.readthedocs.io/en/latest/how_to/documenting_new_feature_toggles.html + # See annotation format documentation: https://docs.openedx.org/projects/openedx-events/en/latest/reference/in-line-code-annotations-for-an-event.html - ".. event_type:": - ".. event_name:": - ".. event_description:":