R022: errcode值(.code)值断言使用"==="非"=="

Official

Find loose .code assertions and enforce strict ===

Authoropenharmonyinsight
Version1.0.0
Installs0

System Documentation

What problem does it solve?

It helps prevent incorrect error-code comparisons in test code by ensuring .code (errcode) assertions use strict equality, avoiding subtle type-coercion bugs.

Core Features & Use Cases

  • Scans test and source files: Checks all source files with extensions .ets, .ts, and .js for occurrences of .code == (non-===).
  • Accurately attributes issues to test cases: Parses it() block ranges so each finding can be mapped to the correct testcase name.
  • Improves consistency and reliability: Generates precise file-and-line findings with a clear suggestion to replace == with ===, including skipping matches inside // comment lines.

Quick Start

Run the R022 rule scan on your OpenHarmony test codebase to list every .code == usage and show the corresponding file, line number, and owning it() testcase.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: R022: errcode值(.code)值断言使用"==="非"=="
Download link: https://github.com/openharmonyinsight/openharmony-skills/archive/main.zip#r022-errcode-code

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.