Files
messaging-library/config/spotbugs/exclude-test.xml
DongHyeonka 31c517888a
pr / ci (pull_request) Successful in 3m58s
build(spotbugs): 제외 목록이 이 repo 클래스만 말하게 다듬는다
템플릿 제외 목록에서 메시징 줄을 골라 옮기면서, 묶음 Match의 주석이
템플릿 클래스(HttpClientProfileFactory, NotificationJsonMapper,
@RequiresPermission 등)를 계속 부른다. 이 repo에 없는 클래스를 읽고
제외 이유를 판단하게 된다. 템플릿의 생성 소스 제외(generated 폴더)도
빠졌다.

주석을 메시징 클래스만 말하게 고치고, 생성 소스 제외 Match를
템플릿과 같이 되살렸다. 클래스를 고르는 Match는 바뀌지 않았다.

위험: 생성 소스 제외는 지금 생성 소스가 없어 아무것도 빼지 않는다.

검증: 이 PR의 pr workflow(./gradlew ci, SpotBugs main·test 포함).
2026-11-08 16:34:02 +09:00

84 lines
4.1 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
SpotBugs + FindSecBugs exclude filter for test code: every source set but main (test,
testFixtures, integrationTest, systemTest, architectureTest and the other lanes). Production code
is analysed by spotbugsMain against config/spotbugs/exclude.xml; this file is never applied to it
(QualityConventionsPlugin, testQualityCheck).
Until 2026-11-04 these tasks existed, ran in no gate, and 53 of them failed with 300 findings.
Each finding was judged. A rule is excluded below only when its reason holds for every test
class it can ever match; everything else was fixed, or is a Match scoped to one class with its
own reason (same rule as exclude.xml).
Test code never reaches a production classpath: test fixtures are consumed only by test suites
(`testImplementation testFixtures(...)`, `implementation testFixtures(project())` inside a
JvmTestSuite), which the dependency-direction gate keeps out of production configurations.
-->
<FindBugsFilter>
<!-- FindSecBugs (category SECURITY): taint, injection, deserialization, crypto, SSRF, path,
ReDoS, hard-coded credential and CSRF rules model untrusted input reaching a production
sink. A test writes its own input, runs only under the test runner, and holds fixture
credentials on purpose. The same code moved to main is analysed with these rules on. -->
<Match>
<Bug category="SECURITY"/>
</Match>
<!-- MALICIOUS_CODE (EI_EXPOSE_REP, EI_EXPOSE_REP2, MS_*): these protect a production object from
a caller that mutates state it was handed. Fakes and fixtures hand their state to the test
on purpose — that is how the test observes them. -->
<Match>
<Bug category="MALICIOUS_CODE"/>
</Match>
<!-- CT_CONSTRUCTOR_THROW: the risk is a finalizer attack by untrusted code that subclasses the
class. Test classes are instantiated by JUnit or by the test itself; a constructor that
throws fails the test. -->
<Match>
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
</Match>
<!-- NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE: a test dereferences a value it expects to be there
(a response body, a header, a map entry). If it is null the NullPointerException fails the
test, which is the failure an unmet expectation should produce; a requireNonNull in front
adds a line and changes nothing. -->
<Match>
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
</Match>
<!-- DLS_DEAD_LOCAL_STORE into a local named `unused` or `ignored`: Error Prone's
CheckReturnValue makes a test keep the result it means to drop (`var unused =
catchThrowable(...)` when only the side effect is asserted), and the name says the value is
dropped on purpose. A dead store to any other name is still reported. -->
<Match>
<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
<Local name="~unused|ignored"/>
</Match>
<!-- RV_RETURN_VALUE_IGNORED_INFERRED / _NO_SIDE_EFFECT inside a lambda: in test code these are
the ThrowingCallable / Executable handed to assertThatThrownBy, isThrownBy, catchThrowable
or assertThrows. Their type is void, so the value cannot be kept, and the call is made for
the exception it throws. RV_RETURN_VALUE_IGNORED (a must-check result such as
CountDownLatch.await) stays reported in lambdas too. -->
<Match>
<Or>
<Bug pattern="RV_RETURN_VALUE_IGNORED_INFERRED"/>
<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
</Or>
<Method name="~lambda\$.*"/>
</Match>
<!-- DM_GC: the test is about what garbage collection does — a retained-set bound measured
between two collections. System.gc() is the request it exists to make. -->
<Match>
<Bug pattern="DM_GC"/>
<Or>
<And>
<Class name="dev.cakit.messaging.schema.json.PlatformOverheadPerformanceTest"/>
<Method name="aRoundTripDoesNotAllocateAGrowingRetainedSet"/>
</And>
</Or>
</Match>
</FindBugsFilter>