一键导入
ruling
Run ruling integration tests and update expected results for SonarJS rules. Use when running ruling tests or syncing expected ruling output.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Run ruling integration tests and update expected results for SonarJS rules. Use when running ruling tests or syncing expected ruling output.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Provides JavaScript/TypeScript test file structure and patterns for SonarJS rule testing. Use when writing tests, understanding test structure, or debugging test failures.
Use before a SonarJS release or when the Peach Main Analysis workflow on SonarSource/peachee-js shows failed jobs or suspicious project issue-count drops that need triage. Classify failed Peach jobs and flag likely project-configuration regressions using docs/peach-main-analysis.md.
Use before a SonarJS release or when the Peach Main Analysis workflow on SonarSource/peachee-js shows failed jobs or suspicious project issue-count drops that need triage. Classify failed Peach jobs and flag likely project-configuration regressions using docs/peach-main-analysis.md.
Provides guidance on implementing and fixing SonarJS rules. Use also when tracing false positives, working with rule configuration, or understanding native vs external rule implementations.
Add or modify rule options in SonarJS, including the fields array, SonarQube UI visibility, and Java check class configuration. Use when working on rule configurations.
Provides test quality standards and best practices. Use when writing test cases, creating unit tests, implementing tests, or refining/reviewing test code. Essential for test generation and test refinement phases.
| name | ruling |
| description | Run ruling integration tests and update expected results for SonarJS rules. Use when running ruling tests or syncing expected ruling output. |
| disable-model-invocation | true |
Ruling tests analyze large third-party codebases (JS/TS and CSS) and compare issues against expected output. Run them when adding or modifying rules to verify real-world behavior.
Warning: Running ruling tests removes
node_modulesfrom the project root. Runnpm ciafterward.
# Prerequisites: init submodules, install dependencies, build JS/TS, then rebuild the jar
git submodule update --init --recursive
npm install
npm run bbf
mvn install -DskipTests
# Run ruling (JS/TS and CSS)
npm run ruling
# Sync actual → expected (after reviewing output)
npm run ruling-sync
# Debug differences
sh tools/ruling-debug-script.sh
Results:
packages/ruling/actual/its/ruling/src/test/expected/cd its/ruling
mvn verify -Dtest=RulingTest -Dmaven.test.redirectTestOutputToFile=false
Copy actual to expected:
cp -R target/actual/ src/test/expected/
Review diff:
diff -rq src/test/expected target/actual
If a new rule raises no issues on existing sources, add test code:
its/sources/custom/jsts/S1234.js — regular codeits/sources/custom/jsts/tests/S1234.js — test codeCopy from RSPEC HTML description (compliant/non-compliant examples).
To debug the Node.js bridge during ruling:
SONARJS_EXISTING_NODE_PROCESS_PORT=<port>@Execution(ExecutionMode.CONCURRENT) from the ruling test class (for serial execution)If submodules aren't checked out:
git submodule init
git submodule update