Findbugs exclude generated files

Julian picture Julian · Aug 21, 2012 · Viewed 8.7k times · Source

I am trying to filter out the generated files from the findbugs check and all I tried does not seem to work. Pretty much part of my build process I create a whole lot of classes that end up in a folder called src/generated I would be interested in filtering out all those classes. I am using maven but I don't think it matters.

Thank you in advance.

Answer

Dave Newton picture Dave Newton · Aug 21, 2012

Without knowing what you tried it's a bit problematic to help.

Here's a fragment we use to skip over a few bug patterns present in code generated by Avro.

<FindBugsFilter>
  <Match>
    <!-- Avro generates redundant "implements" interface declarations -->
    <Or>
      <Package name="~com[.]foo[.]plugh[.]avro([.].*)?"     />
      <Package name="~com[.]foo[.]xyzzy[.]protocol([.].*)?" />
    </Or>

    <Or>
      <Bug pattern="RI_REDUNDANT_INTERFACES" />
      <Bug pattern="NM_CLASS_NAMING_CONVENTION" />
      <Bug pattern="REC_CATCH_EXCEPTION" />
    </Or>
  </Match>
</FindBugsFilter>