Fix #583 - False negative for missing parameter in Params
This commit is contained in:
parent
cb31d2501e
commit
6ca45d8b3f
|
@ -166,8 +166,11 @@ private:
|
||||||
import std.array : array;
|
import std.array : array;
|
||||||
|
|
||||||
const comment = parseComment(commentText, null);
|
const comment = parseComment(commentText, null);
|
||||||
if (!comment.isDitto && !withinTemplate)
|
if (withinTemplate) {
|
||||||
{
|
const paramSection = comment.sections.find!(s => s.name == "Params");
|
||||||
|
if (!paramSection.empty)
|
||||||
|
lastSeenFun.ddocParams ~= paramSection[0].mapping.map!(a => a[0]).array;
|
||||||
|
} else if (!comment.isDitto) {
|
||||||
// check old function for invalid ddoc params
|
// check old function for invalid ddoc params
|
||||||
if (lastSeenFun.active)
|
if (lastSeenFun.active)
|
||||||
postCheckSeenDdocParams();
|
postCheckSeenDdocParams();
|
||||||
|
@ -796,6 +799,40 @@ string bar(P, R)(R r){}// [warn]: %s
|
||||||
}c.format(
|
}c.format(
|
||||||
ProperlyDocumentedPublicFunctions.MISSING_TEMPLATE_PARAMS_MESSAGE.format("P")
|
ProperlyDocumentedPublicFunctions.MISSING_TEMPLATE_PARAMS_MESSAGE.format("P")
|
||||||
), sac);
|
), sac);
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://github.com/dlang-community/D-Scanner/issues/583
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
StaticAnalysisConfig sac = disabledConfig;
|
||||||
|
sac.properly_documented_public_functions = Check.enabled;
|
||||||
|
|
||||||
|
assertAnalyzerWarnings(q{
|
||||||
|
/++
|
||||||
|
Implements the homonym function (also known as `accumulate`)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
the accumulated `result`
|
||||||
|
|
||||||
|
Params:
|
||||||
|
fun = one or more functions
|
||||||
|
+/
|
||||||
|
template reduce(fun...)
|
||||||
|
if (fun.length >= 1)
|
||||||
|
{
|
||||||
|
/++
|
||||||
|
No-seed version. The first element of `r` is used as the seed's value.
|
||||||
|
|
||||||
|
Params:
|
||||||
|
r = an iterable value as defined by `isIterable`
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
the final result of the accumulator applied to the iterable
|
||||||
|
+/
|
||||||
|
auto reduce(R)(R r){}
|
||||||
|
}
|
||||||
|
}c.format(
|
||||||
|
), sac);
|
||||||
|
|
||||||
stderr.writeln("Unittest for ProperlyDocumentedPublicFunctions passed.");
|
stderr.writeln("Unittest for ProperlyDocumentedPublicFunctions passed.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue