Would it be possible to run findbugs/codenarc/etc only on files that have changed during an incremental build?


(Emil Sit) #1

We sometimes find that developers are reluctant to run a full build because modifying a single file causes findbugs/codenarc to get run over all the files in a module. This can take a long time, even if they have only modified a few files. Sometimes they commit without running the code quality plugins which of course breaks in CI.

It seems that Gradle must know that certain files have changed (needed for up-to-date checks on the tasks, you can see it with gradle --info) … can this information be somehow communicated into the task itself so that it only runs static analysis on modified files. I don’t know off-hand if findbugs/codenarc do any cross-file validation but for most change sets that only modify a small number of files this would probably speed up analysis significantly.

It seems that it ought to be possible from the tooling side… you can specify a list of classes to the underlying findbugs ant task or a ‘FileSet’ to the codenarc ant task. As a concrete example, the Eclipse Findbugs Plugin reports that it supports incremental analysis.

How hard would this be to add to Gradle?

Thanks!