aaronchen2k
aaronchen2k

Reputation: 347

Is there a good way to run or only show the bugs for new java files in sonarqube?

I use sonarqube4.3 to do findbugs and checkstyle code review. Is there a good way to run or only show the bugs for new java files(not care the old files)?

Will below codes work? If yes, just package the codes as plugin jar file, right?

public final class CutoffFilter implements InputFileFilter {
    final Logger LOG = LoggerFactory.getLogger(CutoffFilter.class);

    public static String versionStr = "@version $Id:";

    public boolean accept(InputFile file) {
        String path = file.file().getAbsolutePath();
        boolean isNew = isNew(file.file());

        System.out.println("Path" + path);
        System.out.println("Need check" + isNew);
        return isNew;
    } 
    ......
}

public final class CutoffPlugin extends SonarPlugin {

   public List getExtensions() {
        return Arrays.asList(CutoffFilter.class);
   }
}

Upvotes: 1

Views: 68

Answers (1)

benzonico
benzonico

Reputation: 10833

You can display the difference with previous analysis or previous version. It will show you the new issues since last analysis or version. This is not exactly what you ask for but if you have not changed your "old files" you will have what you asked for.

Upvotes: 1

Related Questions