What problem does it solve?
It prevents test cases from containing恒真断言 (tautological assertions) like expect(true).assertTrue() that always succeed and therefore provide no real verification of the system behavior.
Core Features & Use Cases
- Tautology detection in test assertions: Flags expect(true).assertTrue(), expect(true).assertEqual(true), and expect(false).assertFalse() patterns to avoid ineffective tests.
- Precise issue reporting: Produces file, line number, and the surrounding test case name (it() block) so failures can be fixed quickly.
- Actionable remediation guidance: Suggests replacing tautological assertions with assertions on actual values returned by the code under test.
Use case example: When reviewing ArkTS/Javascript unit tests for OpenHarmony, quickly locate and fix thousands of tests that currently “pass” without validating real API outputs, then improve meaningful coverage.
Quick Start
Use the R003 rule to scan your test source files for恒真断言 and output a report listing each violation with its test case name and a suggested replacement.