Skip to content

Commit 5185e7c

Browse files
committed
warnings option
#feat
1 parent 1ab842d commit 5185e7c

File tree

7 files changed

+52
-16
lines changed

7 files changed

+52
-16
lines changed

docs/mrdocs.schema.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,16 @@
439439
],
440440
"title": "Verbose output",
441441
"type": "boolean"
442+
},
443+
"warnings": {
444+
"default": true,
445+
"description": "When set to `true`, MrDocs outputs warning messages during the generation of the documentation. It is usually recommended to enable warnings while writing the documentation.",
446+
"enum": [
447+
true,
448+
false
449+
],
450+
"title": "Enable warning messages",
451+
"type": "boolean"
442452
}
443453
},
444454
"required": [],

src/lib/Lib/ConfigOptions.json

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -416,18 +416,9 @@
416416
]
417417
},
418418
{
419-
"category": "Miscellaneous",
420-
"brief": "Miscellaneous options",
419+
"category": "Warnings",
420+
"brief": "Warnings and progress messages",
421421
"options": [
422-
{
423-
"name": "concurrency",
424-
"command-line-only": true,
425-
"brief": "Number of threads to use",
426-
"details": "The desired level of concurrency: 0 for hardware-suggested.",
427-
"type": "unsigned",
428-
"default": 0,
429-
"min-value": 0
430-
},
431422
{
432423
"name": "verbose",
433424
"brief": "Verbose output",
@@ -460,6 +451,28 @@
460451
],
461452
"default": "info"
462453
},
454+
{
455+
"name": "warnings",
456+
"brief": "Enable warning messages",
457+
"details": "When set to `true`, MrDocs outputs warning messages during the generation of the documentation. It is usually recommended to enable warnings while writing the documentation.",
458+
"type": "bool",
459+
"default": true
460+
}
461+
]
462+
},
463+
{
464+
"category": "Miscellaneous",
465+
"brief": "Miscellaneous options",
466+
"options": [
467+
{
468+
"name": "concurrency",
469+
"command-line-only": true,
470+
"brief": "Number of threads to use",
471+
"details": "The desired level of concurrency: 0 for hardware-suggested.",
472+
"type": "unsigned",
473+
"default": 0,
474+
"min-value": 0
475+
},
463476
{
464477
"name": "ignore-map-errors",
465478
"brief": "Continue if files are not mapped correctly",

src/lib/Metadata/Finalizers/JavadocFinalizer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ finalize(doc::Reference& ref)
128128
MRDOCS_ASSERT(current_context_);
129129
if (auto primaryLoc = getPrimaryLocation(*current_context_))
130130
{
131-
report::warn(
131+
warn(
132132
"{}:{}\n{}: Failed to resolve reference to '{}'",
133133
primaryLoc->FullPath,
134134
primaryLoc->LineNumber,
@@ -284,7 +284,7 @@ copyBriefAndDetails(Javadoc& javadoc)
284284
MRDOCS_ASSERT(current_context_);
285285
if (auto primaryLoc = getPrimaryLocation(*current_context_))
286286
{
287-
report::warn(
287+
warn(
288288
"{}:{}\n"
289289
"{}: Failed to copy documentation from '{}'\n"
290290
" Note: Symbol '{}' not found.",
@@ -306,7 +306,7 @@ copyBriefAndDetails(Javadoc& javadoc)
306306
{
307307
auto ctxPrimaryLoc = getPrimaryLocation(*current_context_);
308308
auto resPrimaryLoc = getPrimaryLocation(*res);
309-
report::warn(
309+
warn(
310310
"{}:{}\n"
311311
"{}: Failed to copy documentation from '{}'.\n"
312312
"No documentation available.\n"

src/lib/Metadata/Finalizers/JavadocFinalizer.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,16 @@ class JavadocFinalizer
159159
return corpus_.find(id) != nullptr;
160160
}));
161161
}
162+
163+
template<class... Args>
164+
void
165+
warn(
166+
Located<std::string_view> format,
167+
Args&&... args) const
168+
{
169+
MRDOCS_CHECK_OR(corpus_.config->warnings);
170+
return log(report::Level::warn, format, std::forward<Args>(args)...);
171+
}
162172
};
163173

164174
} // clang::mrdocs
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
auto-brief: true
1+
auto-brief: true
2+
warnings: false
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
auto-brief: false
1+
auto-brief: false
2+
warnings: false
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
warnings: false

0 commit comments

Comments
 (0)