This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 234603 - Allow FindBugs to be skipped on test classes
Summary: Allow FindBugs to be skipped on test classes
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: FindBugs (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords: PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2013-08-19 16:04 UTC by Jesse Glick
Modified: 2016-11-22 21:45 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Simple solution (no configuration option) (2.77 KB, patch)
2016-11-22 21:44 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2013-08-19 16:04:55 UTC
A lot of times I will be writing a unit test which repeatedly calls some API that I have marked @CheckForNull. In the test I am not going to bother checking for null after each call; the method should not in fact return null in this case, and if it does, the test will catch that in some other way, such as an assertion or a NullPointerException.

Or test code may legitimately do all sorts of things that would be considered inappropriate in production code, like repeatedly sleeping for 100ms, or hardcoding a path name, etc.

Since it is typically of little value to run FindBugs on test code, and it introduces a lot of spurious warning badges, I would recommend disabling the automatic scan on test source roots (or at least doing so optionally).
Comment 1 Jesse Glick 2016-11-22 21:44:46 UTC
Created attachment 162987 [details]
Simple solution (no configuration option)