Use SQ to check for not allowed method usage

Hello,

I’m trying to figure out if there is a builtin function in SQ to find disallowed method usages
system info:
SonarQube - community 9.0.1 clean test instance (default installation)

For example.
say that i have a dependency to the class (runner) and it has some methods that are accessible and one of them has been flagged as vulnerable to some sort of attack.

To help the dev teams with this i want to add a code check for disallowed methods so by any chance there is a usage the developer will get a notice before he or she pushes changes to the main code-repo

Have seen that there is a text-search plugin that has been recommended but is not tested yet, i would like to know if there is a better way to apply this search with SQ before we start to add extra plugins.

have alls been looking at this function “Track uses of disallowed methods”

code example:

public class main {   
    public static void main(String[] args) {        
        Runner runner = new Runner();
        runner.hit(); <- disallowed to use
        String name = runner.name(); <- allowed to use
    }
}
public class Runner{
    		public void hit(){ 
    		}
    		public String name(){
        		return "something";
  		  }
	}
}

Hi,

What language are you looking for this for?

 
Ann