diff --git a/src/dscanner/analysis/incorrect_infinite_range.d b/src/dscanner/analysis/incorrect_infinite_range.d index ce3e339..055f05b 100644 --- a/src/dscanner/analysis/incorrect_infinite_range.d +++ b/src/dscanner/analysis/incorrect_infinite_range.d @@ -126,6 +126,22 @@ unittest } } +struct InfiniteRange +{ + bool empty() => false; // [warn]: %1$s + bool stuff() => false; + unittest + { + return false; + } + + // https://issues.dlang.org/show_bug.cgi?id=18409 + struct Foo + { + ~this() nothrow @nogc; + } +} + bool empty() { return false; } class C { bool empty() { return false; } } // [warn]: %1$s diff --git a/src/dscanner/analysis/properly_documented_public_functions.d b/src/dscanner/analysis/properly_documented_public_functions.d index a27f313..3f7b3c9 100644 --- a/src/dscanner/analysis/properly_documented_public_functions.d +++ b/src/dscanner/analysis/properly_documented_public_functions.d @@ -190,7 +190,8 @@ final class ProperlyDocumentedPublicFunctions : BaseAnalyzer import std.array : Appender; // ignore header declaration for now - if (!decl.functionBody || !decl.functionBody.specifiedFunctionBody) + if (!decl.functionBody || (!decl.functionBody.specifiedFunctionBody + && !decl.functionBody.shortenedFunctionBody)) return; if (nestedFuncs == 1) @@ -659,6 +660,20 @@ int foo(int k){} // [warn]: %s assertAnalyzerWarnings(q{ /** + * Description. + * + * Params: + * + * Returns: + * A long description. + */ +int foo(int k) => k; // [warn]: %s + }c.format( + ProperlyDocumentedPublicFunctions.MISSING_PARAMS_MESSAGE.format("k") + ), sac); + + assertAnalyzerWarnings(q{ +/** Description. Params: diff --git a/src/dscanner/analysis/unused_label.d b/src/dscanner/analysis/unused_label.d index ed02880..b70d398 100644 --- a/src/dscanner/analysis/unused_label.d +++ b/src/dscanner/analysis/unused_label.d @@ -51,10 +51,8 @@ final class UnusedLabelCheck : BaseAnalyzer functionBody.specifiedFunctionBody.accept(this); popScope(); } - if (functionBody.missingFunctionBody && functionBody.missingFunctionBody.functionContracts) + if (functionBody.missingFunctionBody && functionBody.missingFunctionBody.functionContracts) functionBody.missingFunctionBody.functionContracts.each!((a){pushScope(); a.accept(this); popScope();}); - if (functionBody.specifiedFunctionBody && functionBody.specifiedFunctionBody.functionContracts) - functionBody.specifiedFunctionBody.functionContracts.each!((a){pushScope(); a.accept(this); popScope();}); } override void visit(const LabeledStatement labeledStatement)