How to Ignore Extraneous Crap

Mike Slinn suggests annotations to exclude methods that you don’t want contributing to the Crap score. I think some form of exclusion is definitely a good idea. I am curious what type would work best.

I can think of at least 4 ways to get various levels of exclusion:

  • Add annotations that can affect the method. (May also want these at the class level or beyond)
  • For class-level exclusion, use the about-to-be-released Ant task, which can do file excludes and includes.
  • Have an exclude list that takes patterns like ‘MyClass#myMethod(Ljava/lang/Object;):Void’
  • Use different compilation output directories for classes that do not ship. This is the way many people manage their test suites.

I am thinking that annotations are the cleanest, at least for the method level. It seems like the approach chosen depends on how many exclusions one wants to do. The annotations could be spread all over the code and troublesome to maintain, but on the other hand they are great for a small number of exclusions.

What do you think? Any altogether different way to do it? If we went with annotations, what is a good name. I find Mike’s suggestions amusing.

Comments are closed.