CI: run SonarCloud analysis on PRs (Clean-as-You-Code) to catch new S3415 and similar regressions
维护者通常 1 天内回复
@milamberspace 已经在做这个了。
开始于 2026年7月10日。
评估
这个 Issue 还没有评估数据。
描述
Context
#6718 fixed ~90 occurrences of SonarQube rule java:S3415 ("assertion arguments passed in the wrong order" — assertEquals(actual, expected) instead of assertEquals(expected, actual)) across the test suite.
These accumulated because SonarCloud analysis currently runs out-of-band — a nightly report to https://sonarcloud.io/dashboard?id=JMeter via the org.sonarqube Gradle plugin — not as a per-PR check. So nothing flags a new violation when a PR introduces one.
Opening this per the discussion on #6718 (@vlsi asked whether we can add something to avoid re-introducing this type of error).
Options (rough order of effort)
1. Add SonarCloud PR analysis to the GitHub Actions CI (preferred).
The org.sonarqube plugin is already wired (org apache, project JMeter); the missing piece is a sonar step on the PR workflow plus SonarCloud's "Clean as You Code" quality gate, which fails a PR that introduces a new violation. This directly targets S3415 (and every other Sonar rule) at review time. S3415 is heuristic (name-based — it fires when a literal/constant sits in the "actual" slot), so it catches the common cases, not 100%.
2. Error Prone ArgumentSelectionDefectChecker.
Error Prone already runs in CI (the "Error Prone (JDK 21)" job), so this is the cheapest to trial. It can flag swapped variables whose names don't match the expected / actual parameters, but is unreliable for literals. Evaluate signal vs. noise before promoting it to an error.
3. AssertJ migration (largest, most durable).
assertThat(actual).isEqualTo(expected) removes the ambiguity by construction — there's no "which arg is expected?" left to get wrong. A big, separate effort, but it eliminates the whole class of bug instead of policing it.
Notes
- SonarCloud PR analysis needs a
SONAR_TOKEN(orgapache) available to the workflow — coordinate with ASF Infra / the existing nightly setup, and mind that PR analysis from forks needs apull_request_target-style flow or the token exposed safely. - Related PR: #6718 (the fix that surfaced this).
- 主要语言
- Java
- 星标
- 9.6k
- 派生
- 2.3k
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 13
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/jmeter 的其他 Issue
-
[Bug] Typo in assertion property name: "Asserion.test_strings" missing 't'可能已有人在做 @waterWang 于 66 天前认领。 未关闭defect to-triage
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
enhancement to-triage
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
RandomDate ignores inclusive end date and throws when start == end可能已有人在做 @weillercarvalho 于 343 天前认领。 未关闭defect to-triage
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
documentation to-triage
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
invalid wontfix
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
相似的 Issue
-
[BUG] jackson3 JacksonJsonpMapper(ObjectMapper) fails to deserialize `_source` with "Trailing token" error可能已有人在做 @junyeokk 今天认领。 未关闭bug untriaged
难度 2/5 1-3 小时 新手友好度 82/100
opensearch-project/opensearch-java#2236 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
cloudfoundry/cf-java-client#1392 ·
维护者通常 2 天内回复
-
Posting fails with "Context too long"可能已有人在做 @jimklimov 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 67/100
-
难度 2/5 1-3 小时 新手友好度 62/100
open-learning-exchange/myplanet#18392 ·
维护者通常 2 天内回复