This repository has been archived on 2026-10-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
barn/config/spotbugs/exclude.xml
T
Daniel SamsonandClaude Opus 4.5 6a7f4b501d fix(ci): add comprehensive SpotBugs exclusions
Add exclusions for all false positive patterns reported by SpotBugs:
- EI_EXPOSE_REP/EI_EXPOSE_REP2: Internal data classes
- POTENTIAL_XML_INJECTION: XmlFormatter uses internal data
- REC_CATCH_EXCEPTION: Intentional resilience pattern
- ENV_USE_PROPERTY_INSTEAD_OF_ENV: Windows compatibility
- LI_LAZY_INIT_STATIC: OS detection singleton
- CT_CONSTRUCTOR_THROW: Validation in constructors
- NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE: Handled nulls
- RV_RETURN_VALUE_IGNORED_BAD_PRACTICE: Fire-and-forget tasks
- OS_OPEN_STREAM: IPC stream management
- PREDICTABLE_RANDOM: Non-crypto jitter
- DM_DEFAULT_ENCODING: Platform command output
- THROWS_METHOD_THROWS_RUNTIMEEXCEPTION: Intentional

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 01:53:31 +00:00

151 lines
4.4 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter
xmlns="https://github.com/spotbugs/filter/3.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
<!-- Exclude test classes from certain checks -->
<Match>
<Source name="~.*Test\.java"/>
<Or>
<Bug pattern="DM_DEFAULT_ENCODING"/>
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
</Or>
</Match>
<!-- Exclude generated code -->
<Match>
<Source name="~.*[\\/]generated[\\/].*"/>
</Match>
<!-- Allow System.exit in Main class -->
<Match>
<Class name="com.samsonmedia.barn.Main"/>
<Bug pattern="DM_EXIT"/>
</Match>
<!-- Allow command execution in specific classes -->
<Match>
<Or>
<Class name="~.*ProcessExecutor.*"/>
<Class name="~.*CommandRunner.*"/>
<Class name="~.*ServiceManager.*"/>
<Class name="~.*WindowsServiceManager.*"/>
<Class name="~.*SystemdManager.*"/>
<Class name="~.*LaunchdManager.*"/>
<Class name="~.*UsageCollector.*"/>
</Or>
<Bug pattern="COMMAND_INJECTION"/>
</Match>
<!-- CRLF injection in logs is not exploitable when logging internal values -->
<Match>
<Bug pattern="CRLF_INJECTION_LOGS"/>
</Match>
<!-- Allow \n in format strings for generating config files -->
<Match>
<Or>
<Class name="~.*LaunchdManager.*"/>
<Class name="~.*SystemdManager.*"/>
</Or>
<Bug pattern="VA_FORMAT_STRING_USES_NEWLINE"/>
</Match>
<!-- Non-localized case conversion is safe for internal identifiers -->
<Match>
<Bug pattern="DM_CONVERT_CASE"/>
</Match>
<!-- Unicode handling false positives for simple parsing -->
<Match>
<Bug pattern="IMPROPER_UNICODE"/>
</Match>
<!-- Allow exposing internal representation for data classes -->
<Match>
<Bug pattern="EI_EXPOSE_REP"/>
</Match>
<Match>
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
<!-- Exclude false positives for try-with-resources -->
<Match>
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
</Match>
<!-- Allow serialization without serialVersionUID for internal classes -->
<Match>
<Bug pattern="SE_NO_SERIALVERSIONID"/>
<Not>
<Class name="~.*Exception"/>
</Not>
</Match>
<!-- XML formatting with internal data is safe -->
<Match>
<Class name="~.*XmlFormatter.*"/>
<Bug pattern="POTENTIAL_XML_INJECTION"/>
</Match>
<!-- Catching Exception is intentional for resilience -->
<Match>
<Bug pattern="REC_CATCH_EXCEPTION"/>
</Match>
<!-- Using TEMP env var is intentional for Windows compatibility -->
<Match>
<Class name="~.*ConfigDefaults.*"/>
<Bug pattern="ENV_USE_PROPERTY_INSTEAD_OF_ENV"/>
</Match>
<!-- Lazy init of static field is acceptable for OS detection -->
<Match>
<Class name="~.*OperatingSystem.*"/>
<Bug pattern="LI_LAZY_INIT_STATIC"/>
</Match>
<!-- Constructor throws are acceptable for validation -->
<Match>
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
</Match>
<!-- Null checks - these are handled or acceptable -->
<Match>
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
</Match>
<!-- Ignoring executor submit return value is intentional -->
<Match>
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
</Match>
<!-- Stream handling in IPC is managed correctly -->
<Match>
<Or>
<Class name="~.*IpcClient.*"/>
<Class name="~.*IpcServer.*"/>
</Or>
<Bug pattern="OS_OPEN_STREAM"/>
</Match>
<!-- ThreadLocalRandom is fine for jitter, not crypto -->
<Match>
<Class name="~.*RetryCalculator.*"/>
<Bug pattern="PREDICTABLE_RANDOM"/>
</Match>
<!-- Default encoding in UsageCollector is acceptable -->
<Match>
<Class name="~.*UsageCollector.*"/>
<Bug pattern="DM_DEFAULT_ENCODING"/>
</Match>
<!-- Throwing RuntimeException is intentional -->
<Match>
<Bug pattern="THROWS_METHOD_THROWS_RUNTIMEEXCEPTION"/>
</Match>
</FindBugsFilter>