Skip to content

Commit ca8bbbe

Browse files
committed
warn-as-error option
#feat
1 parent 6412c80 commit ca8bbbe

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

docs/mrdocs.schema.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,16 @@
450450
"title": "Verbose output",
451451
"type": "boolean"
452452
},
453+
"warn-as-error": {
454+
"default": false,
455+
"description": "When set to `true`, MrDocs treats warnings as errors and stops the generation of the documentation.",
456+
"enum": [
457+
true,
458+
false
459+
],
460+
"title": "Treat warnings as errors",
461+
"type": "boolean"
462+
},
453463
"warn-broken-ref": {
454464
"default": true,
455465
"description": "When set to `true`, MrDocs outputs a warning message if a reference in the documentation is broken.",

src/lib/Lib/ConfigOptions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,13 @@
513513
"details": "When set to `true`, MrDocs outputs a warning message if a reference in the documentation is broken.",
514514
"type": "bool",
515515
"default": true
516+
},
517+
{
518+
"name": "warn-as-error",
519+
"brief": "Treat warnings as errors",
520+
"details": "When set to `true`, MrDocs treats warnings as errors and stops the generation of the documentation.",
521+
"type": "bool",
522+
"default": false
516523
}
517524
]
518525
},

src/lib/Metadata/Finalizers/JavadocFinalizer.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ class JavadocFinalizer
170170
Args&&... args) const
171171
{
172172
MRDOCS_CHECK_OR(corpus_.config->warnings);
173-
return log(report::Level::warn, format, std::forward<Args>(args)...);
173+
auto const level = !corpus_.config->warnAsError ? report::Level::warn : report::Level::error;
174+
return log(level, format, std::forward<Args>(args)...);
174175
}
175176

176177
void

0 commit comments

Comments
 (0)