You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 2, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 2, 2026. It is now read-only.
I want to write my own validator based on the TrivadisGuidelines3Plus.xtend.
In my case I want to override the G-1050 but I'm really struggling because first of all I don't know what >the method is called to override. I was guessing "checkGuideline1050" because some with other >numbers exist. But 1050 doesnt.
Basically I want something like:
override checkGuideline1050(FunctionHeading f){
if(NOT f.function.startsWith('logger')){
super.checkGuideline1050(f);
}
}```
Could you please give me guidance on how to approach this?
@S-Koell The guideline check G-1050 was already part of the Trivadis guidelines v2. Back then it was named G-05. Hence the check methods were also named checkGuideline5. There are two implemented one for string literals and one for number literals. I've created an example where I've re-implemented the guideline completely. See here. In your case you could also simplify the implementation to:
And I think this issue here is the right place to ask the development topics from the issue #10 :
How could I have known what to do there myself? So many questions from my side:
How would I find the correct method to override
With no idea what the classes are representing there is no way I could have coded that ( e.g. what is SimpleExpressionStringValue, BinaryCompoundExpressionLevel6 , ... )
The current implementation is not wrong. It just reimplements the validation completely. I wanted to make clear that reusing the existing implementation is also possible.
Activity
PhilippSalvisberg commentedon Dec 15, 2019
@S-Koell The guideline check G-1050 was already part of the Trivadis guidelines v2. Back then it was named G-05. Hence the check methods were also named checkGuideline5. There are two implemented one for string literals and one for number literals. I've created an example where I've re-implemented the guideline completely. See here. In your case you could also simplify the implementation to:
It's a bit tricky to navigate the parse tree. I typically implement the code with the help of the debugger, which I call from a test.
S-Koell commentedon Jan 16, 2020
Sorry for the late response but: WOW huge thanks for actually coding everything there!
But shouldn't it be:
And I think this issue here is the right place to ask the development topics from the issue #10 :
How could I have known what to do there myself? So many questions from my side:
PhilippSalvisberg commentedon Jan 16, 2020
No,
super.checkGuideline5(literal)is correct. You just want to execute the standard behavior when the expression is not part of the logger call.Regarding the other questions, I suggest to open dedicated issues. Thank you.
S-Koell commentedon Jan 16, 2020
I agree.
But currently the code is:
No call to super. That's why I asked if it's correct.
PhilippSalvisberg commentedon Jan 16, 2020
The current implementation is not wrong. It just reimplements the validation completely. I wanted to make clear that reusing the existing implementation is also possible.
S-Koell commentedon Jan 16, 2020
Understood. I thought that this could be the case but I couldn't be sure without knowing the default implementation, hence the question.
Thanks for clarification and a HUGE thanks for all the great and fast support you give!