java-lint
Skill739 starsChanged 6 days agoApache-2.0View on GitHub
Enable one mechanically enforceable lint or static-analysis rule in blocking CI, preferring SpotBugs. Use when adding a SpotBugs detector, turning a repetitive PR review theme into a lint, adding a ForbiddenAPIs signature, or writing a custom Gradle source check.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- build-logic/AGENTS.mdAGENTS.md
- buildSrc/AGENTS.mdAGENTS.md
- build-logic/CLAUDE.mdCLAUDE.md
- buildSrc/CLAUDE.mdCLAUDE.md
- .claude/CLAUDE.mdCLAUDE.md
- apm-integrationsSkill
- clarify-java-commentsSkill
- fix-continuation-leakageSkill
- migrate-groovy-to-javaSkill
- migrate-junit-source-to-tabletestSkill
- perf-reviewSkill
- reproduce-ci-flakinessSkill
- resolve-muzzle-ciSkill
- review-groovy-migrationSkill
- techdebtSkill
- fix-continuation-leakageSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 5 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 37
Run: ./gradlew check -PskipTests includes all enabled SpotBugs tasks and other checks
- Very specific: line 40
Keep tests, smoke tests (:dd-smoke-tests), generated sources, and vendored trees out unless the user explicitly expands the filter.
- Very specific: line 49
Do not enable a detector family or bulk-remove omitVisitors entries.
- Very specific: line 50
Keep the convention's ignoreFailures = false for production tasks.
- Distinctive: line 52
Do not enable SpotBugs on test or smoke-test source sets unless asked.
- Very specific: line 55
Do not widen the shared exclusion filter, onlyAnalyze, or the production-source task filter unless asked.
- Very specific: line 56
Do not use @SuppressFBWarnings as the way to land a noisy check.
- Very specific: line 59
Do not treat this as a format change.
- Very specific: line 61
Keep omitVisitors accurate: a deferred detector belongs in that list, not in a comment elsewhere.
- Very specific: line 67
If a visitor in omitVisitors matches, that is the check to enable.
- Very specific: line 68
If a matching visitor is absent from omitVisitors, check its defaults in the SpotBugs version in use and the task configuration.
- Distinctive: line 70
If no SpotBugs detector can express the rule, follow other vehicles.
- Very specific: line 75
Run all enabled production SpotBugs tasks.
- Distinctive: line 83
If the rule targets one module, check it first, then all modules.
- Distinctive: line 87
Do not edit generated, vendored, or smoke-test sources to silence SpotBugs.
- Very specific: line 88
Do not paper over findings with a blanket exclusion-filter match.
- Distinctive: line 90
If the cleanup is large or opinionated, undo this change's visitor activation and stop.
- Very specific: line 93
Keep the check only if all selected analysis tasks succeed.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add a Java lint rule
Grow the blocking SpotBugs job one check at a time. Do not turn this into a style-guide dump or a Spotless / google-java-format gate.
Locate build logic by plugin ID. Search both filenames and plugin registrations, then follow applied plugins and implementation classes.
Background: SpotBugs detector list. Fallbacks: other vehicles.
This repository
- Convention:
dd-trace-java.conventions.spotbugs, which appliescom.github.spotbugs - Production sources:
mainandmain_java<N>(Nis the Java language level) in modules using that convention, subject to shared filters and module overrides - Enabled task names:
spotbugsMainandspotbugsMain_java<N>; tests, benchmarks and smoke-test modules are disabled by the convention - Run:
./gradlew check -PskipTestsincludes all enabled SpotBugs tasks and other checks - CI:
check_base/check_inst/check_profiling/check_debuggerrun Gradlecheck, which includes those tasks
Keep tests, smoke tests (:dd-smoke-tests), generated sources, and vendored trees out unless the user explicitly
expands the filter.
omitVisitors in the SpotBugs convention is the deferred-check list. Follow its excludeFilter property to the shared
path/class filter. @SuppressFBWarnings is the local override.
Hard constraints
- Enable one check per change. Prefer removing one name from
omitVisitorsover adding a new detector. - Do not enable a detector family or bulk-remove
omitVisitorsentries. - Keep the convention's
ignoreFailures = falsefor production tasks. Do not mark GitLabcheck_*jobsallow_failure. - Do not enable SpotBugs on test or smoke-test source sets unless asked.
- Production source sets include
mainand version-specific sets such asmain_java11,main_java17,main_java21andmain_java25, etc. Check the shared SpotBugs convention for the enabled sets and report any coverage gaps. - Do not widen the shared exclusion filter,
onlyAnalyze, or the production-source task filter unless asked. - Do not use
@SuppressFBWarningsas the way to land a noisy check. If the detector is too noisy, leave the visitor omitted. For an intentional local exception, keep the detector enabled and annotate that site with@SuppressFBWarnings(value = "…", justification = "…"). - Do not treat this as a format change. Run
./gradlew spotlessApplyonly if you touched Java/Gradle files that Spotless owns. - Keep
omitVisitorsaccurate: a deferred detector belongs in that list, not in a comment elsewhere.
Workflow
- Classify the rule. Prefer SpotBugs. Read the SpotBugs convention and the
detector list.
- If a visitor in
omitVisitorsmatches, that is the check to enable. - If a matching visitor is absent from
omitVisitors, check its defaults in the SpotBugs version in use and the task configuration. Stop only if the detector is already enabled. - If no SpotBugs detector can express the rule, follow other vehicles. Do not invent a custom SpotBugs detector unless the user asks.
- If a visitor in
- Enable one visitor in the shared SpotBugs convention. Remove it from
omitVisitorsif present, or explicitly enable it if it is disabled by default. Review all bug patterns it reports and use@SuppressFBWarningswith a justification for intentional exceptions. Run all enabled production SpotBugs tasks. From the repo root,
checkincludes them along with other checks:./gradlew check -PskipTestsFor SpotBugs only, list tasks with
./gradlew tasks --all, then runspotbugsMainand all enabledspotbugsMain_java<N>tasks. If the rule targets one module, check it first, then all modules.- If it fails:
- Mechanical first-party fixes in the enabled production source sets are OK in the same change. Read their source directories from the module configuration.
- Do not edit generated, vendored, or smoke-test sources to silence SpotBugs.
- Do not paper over findings with a blanket exclusion-filter match. A justified
@SuppressFBWarningson an intentional exception is OK; a pile of suppressions to make a noisy detector pass is not. - If the cleanup is large or opinionated, undo this change's visitor activation and stop. Report the failing classes and the changes they need to the main assistant, so it can ask the user before starting a repo-wide rewrite.
- Keep the check only if all selected analysis tasks succeed. Confirm that the tasks covering the changed code ran
with
ignoreFailures = false.
Reports
Find HTML report locations in each SpotBugsTask's reports configuration.
Bug codes in those reports (NP_…, DCN_…) are not the omitVisitors names. Visitors are detector class names
(FindNullDeref, DefaultEncodingDetector). Suppressions use the bug code:
@SuppressFBWarnings(value = "NP_BOOLEAN_RETURN_NULL", justification = "…")Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

