mirror of
https://github.com/dlang-community/D-Scanner.git
synced 2025-04-27 13:50:02 +03:00
scan UDA to disable linting: handle useless_initializer check
This commit is contained in:
parent
68fd868f26
commit
b038879c22
1 changed files with 17 additions and 0 deletions
|
@ -92,7 +92,24 @@ public:
|
||||||
override void visit(const(Declaration) decl)
|
override void visit(const(Declaration) decl)
|
||||||
{
|
{
|
||||||
_inStruct.insert(decl.structDeclaration !is null);
|
_inStruct.insert(decl.structDeclaration !is null);
|
||||||
|
|
||||||
|
const msgDisabled = () {
|
||||||
|
foreach(attr; decl.attributes)
|
||||||
|
{
|
||||||
|
if(this.isCheckDisabled(attr))
|
||||||
|
{
|
||||||
|
disableErrorMessage();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}();
|
||||||
|
|
||||||
decl.accept(this);
|
decl.accept(this);
|
||||||
|
|
||||||
|
if(msgDisabled)
|
||||||
|
reenableErrorMessage();
|
||||||
|
|
||||||
if (_inStruct.length > 1 && _inStruct[$-2] && decl.constructor &&
|
if (_inStruct.length > 1 && _inStruct[$-2] && decl.constructor &&
|
||||||
((decl.constructor.parameters && decl.constructor.parameters.parameters.length == 0) ||
|
((decl.constructor.parameters && decl.constructor.parameters.parameters.length == 0) ||
|
||||||
!decl.constructor.parameters))
|
!decl.constructor.parameters))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue