Check Variable Type in Application


Sonarqube v7.7

I am trying to validate a variableType and VariableName whether it is declared and used inside methods.

For eg: Usage of Loggers and log.types(info,debug…)

If the class and methods declared inside the class not consists of any usage of loggers, I have to raise issue. For that with the help of VariableTree I am validating the data. But when i run the sonar-scanner it is reporting the issues for each variable usage (getting same issue message) in class.

I want to raise the issue only once in a class, if there is no usage of loggers. Any possible way to scan all variable at a time and return issue once if the variable is not found.