Respect "skip unittest" user configuration (#139)
This commit is contained in:
parent
4506b01676
commit
1294a768d7
|
|
@ -24,6 +24,9 @@ extern(C++) class ExplicitlyAnnotatedUnittestCheck(AST) : BaseAnalyzerDmd
|
||||||
{
|
{
|
||||||
import dmd.astenums : STC;
|
import dmd.astenums : STC;
|
||||||
|
|
||||||
|
if (skipTests)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!(d.storage_class & STC.safe || d.storage_class & STC.system))
|
if (!(d.storage_class & STC.safe || d.storage_class & STC.system))
|
||||||
addErrorMessage(cast(ulong) d.loc.linnum, cast(ulong) d.loc.charnum,
|
addErrorMessage(cast(ulong) d.loc.linnum, cast(ulong) d.loc.charnum,
|
||||||
KEY, MESSAGE);
|
KEY, MESSAGE);
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@ extern (C++) class HasPublicExampleCheck(AST) : BaseAnalyzerDmd
|
||||||
|
|
||||||
override void visit(AST.UnitTestDeclaration unitTestDecl)
|
override void visit(AST.UnitTestDeclaration unitTestDecl)
|
||||||
{
|
{
|
||||||
|
if (skipTests)
|
||||||
|
return;
|
||||||
|
|
||||||
if (unitTestDecl.comment() !is null)
|
if (unitTestDecl.comment() !is null)
|
||||||
isDocumented = true;
|
isDocumented = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ extern (C++) class LabelVarNameCheck(AST) : BaseAnalyzerDmd
|
||||||
|
|
||||||
mixin FunctionVisit!(AST.FuncDeclaration);
|
mixin FunctionVisit!(AST.FuncDeclaration);
|
||||||
mixin FunctionVisit!(AST.TemplateDeclaration);
|
mixin FunctionVisit!(AST.TemplateDeclaration);
|
||||||
mixin FunctionVisit!(AST.UnitTestDeclaration);
|
|
||||||
mixin FunctionVisit!(AST.FuncLiteralDeclaration);
|
mixin FunctionVisit!(AST.FuncLiteralDeclaration);
|
||||||
|
|
||||||
mixin AggregateVisit!(AST.ClassDeclaration);
|
mixin AggregateVisit!(AST.ClassDeclaration);
|
||||||
|
|
@ -134,6 +133,28 @@ extern (C++) class LabelVarNameCheck(AST) : BaseAnalyzerDmd
|
||||||
popAggregateName();
|
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(unitTestDecl);
|
||||||
|
popScope();
|
||||||
|
|
||||||
|
isInFunction = oldIsInFunction;
|
||||||
|
isInLocalFunction = oldIsInLocalFunction;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
extern (D) Thing[string][] stack;
|
extern (D) Thing[string][] stack;
|
||||||
int conditionalDepth;
|
int conditionalDepth;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue