From 62f2a73cac70237c83054345a26b19c9e0a0ee2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Sun, 14 Apr 2024 22:07:55 +0200 Subject: [PATCH] fail when an example doesn't set doc-scrape-examples (#12964) # Objective - Ensure that all examples are scrapped for doc ## Solution - Panic in the example tool when an example doesn't specify `doc-scrape-examples` - If an example must not be scrapped, it can set the value to false --- tools/build-templated-pages/src/examples.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/build-templated-pages/src/examples.rs b/tools/build-templated-pages/src/examples.rs index 8c3f41d48e..f973ab68a0 100644 --- a/tools/build-templated-pages/src/examples.rs +++ b/tools/build-templated-pages/src/examples.rs @@ -58,6 +58,9 @@ fn parse_examples(panic_on_missing: bool) -> Vec { if panic_on_missing && metadatas.get(&technical_name).is_none() { panic!("Missing metadata for example {technical_name}"); } + if panic_on_missing && val.get("doc-scrape-examples").is_none() { + panic!("Example {technical_name} is missing doc-scrape-examples"); + } if metadatas .get(&technical_name)