Custom rule for multiple java classes

Can you please let me know if there is way to write a check when it spans across multiple java classes.

For Example: we want to check if there is DB call made in loop, in the below example the call from first class is made to a second class. Can we want check if helper method is a call to DB. Is it possible to write a rule for this scenario? Can you please point me to custom rule that checks across class files.

public class First {
  public void method1(){
       Second secRef = new Second();
       List<String> res = new ArrayList<>();

       for(int i=0;i<n;i++){

public class Second{
  public String helper(int i){
        //      call database
        String result;
        result = DAO.callSQL(i);
        return result;


What language are we talking about?


Hi Ann,

Thanks for response.

This custom rule requirement is for java classes.

Generally rules are written for one java class but we need a way to write a rule for multiple classes.

Regards, Venkatesh

Hello @sachin.desai7,

Unfortunately, there is no way to write custom rules for Java that span across multiple files at the moment.