diff --git a/src/dscanner/analysis/explicitly_annotated_unittests.d b/src/dscanner/analysis/explicitly_annotated_unittests.d index 57702482..db66e7ed 100644 --- a/src/dscanner/analysis/explicitly_annotated_unittests.d +++ b/src/dscanner/analysis/explicitly_annotated_unittests.d @@ -24,6 +24,9 @@ extern(C++) class ExplicitlyAnnotatedUnittestCheck(AST) : BaseAnalyzerDmd { import dmd.astenums : STC; + if (skipTests) + return; + if (!(d.storage_class & STC.safe || d.storage_class & STC.system)) addErrorMessage(cast(ulong) d.loc.linnum, cast(ulong) d.loc.charnum, KEY, MESSAGE); diff --git a/src/dscanner/analysis/has_public_example.d b/src/dscanner/analysis/has_public_example.d index fe5a9102..b8b2e34d 100644 --- a/src/dscanner/analysis/has_public_example.d +++ b/src/dscanner/analysis/has_public_example.d @@ -47,6 +47,9 @@ extern (C++) class HasPublicExampleCheck(AST) : BaseAnalyzerDmd override void visit(AST.UnitTestDeclaration unitTestDecl) { + if (skipTests) + return; + if (unitTestDecl.comment() !is null) isDocumented = true; } diff --git a/src/dscanner/analysis/label_var_same_name_check.d b/src/dscanner/analysis/label_var_same_name_check.d index b891d6c7..a86c730f 100644 --- a/src/dscanner/analysis/label_var_same_name_check.d +++ b/src/dscanner/analysis/label_var_same_name_check.d @@ -134,6 +134,28 @@ extern (C++) class LabelVarNameCheck(AST) : BaseAnalyzerDmd popAggregateName(); } + override void visit(AST.UnitTestDeclaration unitTestDecl) + { + if (skipTests) + return; + + auto oldIsInFunction = isInFunction; + auto oldIsInLocalFunction = isInLocalFunction; + + pushScope(); + + if (isInFunction) + isInLocalFunction = true; + else + isInFunction = true; + + super.visit(n); + popScope(); + + isInFunction = oldIsInFunction; + isInLocalFunction = oldIsInLocalFunction; + } + private: extern (D) Thing[string][] stack; int conditionalDepth;