Skip to content

Commit

Permalink
Respect "skip unittest" user configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladiwostok committed Sep 23, 2024
1 parent 94cc1ce commit c7c50bb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dscanner/analysis/explicitly_annotated_unittests.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/dscanner/analysis/has_public_example.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
22 changes: 22 additions & 0 deletions src/dscanner/analysis/label_var_same_name_check.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c7c50bb

Please sign in to comment.