If you have Java files for which you do not want to have metrics calculated, you can exclude them. To do this, open the project's Properties in any Java Perspective and select the 'Metrics' tab. You can either choose the files to ignore by browsing the file system -- press 'Add Files...' -- or you can enter a Perl5 regular expression that matches the file path -- press 'Add Regex...'.
Regular expressions are particularly useful when you have a naming convention for classes such as Mocks, Visitors, Mementos, etc. As an example, if you want to exclude all classes with 'Mock' in the path , you could specify the regex ".*Mock.*".