In our project we use generated files (from EMF, Xtend, Xtext etc.). In these java files we don't want FindBugs to analyze code.

We suppress analysis based on class/package name. However editing this file is ridiculous, one have to specify these names with regular expressions. Typos and double suppression also makes our life hard (and our build failed).

Any tool to help with that?

  • You might find better help on a form dedicated to FindBugs – Mawg Oct 21 '17 at 8:30
  • There are plenty of experienced people here too. Someone just posted a workaround for my problem :) – Adam Horvath Oct 21 '17 at 14:28

One possibility would be to:

  1. Ensure that your generated files are not under version control, (they almost certainly shouldn't be anyway), and are excluded/ignored from the version control, (they should be). This should already be done anyway hopefully.
  2. Write a small script, (I would use Python), to automatically convert the .gitignore file, (or the equivalent for your VCS), to generate the FindBugs filter file.
  3. Add running the script to the build process.

This way your filter will tell FindBugs to ignore the same files as the VCS so there is only one lot of maintenance to do.

IMHO if you are not using and maintaining the ignores for a decent VCS then you have much bigger problems than FindBugs filters.

  • We have an older and a newer integration server. On the older we could not manage to generate all what we need; but once we're switched it off your solution will work for us. Thank you! – Adam Horvath Oct 21 '17 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.