R008: 用例声明格式不规范

Detect malformed JSDoc comment blocks before it() declarations in test files.

31|6|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill r008
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: R008: 用例声明格式不规范
Source: https://github.com/openharmonyinsight/openharmony-skills/tree/main/skills/check-test-code-quality/rules/R008
Command: npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill r008

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you find XTS test cases whose JSDoc-style comment blocks are not declared in the required format, which can break review consistency and make test code harder to maintain.

Core Features & Use Cases

  • Comment block format validation: Checks that doc comments use the required /** ... */ structure and that each line starts with *.
  • Tag correctness for test case metadata: Ensures parameters like @tc.name / @tc.number use the @ modifier and disallows incorrect separators such as : instead of whitespace.
  • Attachment rule enforcement: Verifies that the doc comment ends immediately before the it('...') test case declaration without unintended empty lines.
  • Scope: Scans only test files with extensions .test.ets, .test.ts, .test.js.

Quick Start

Run the R008 rule scan on your codebase to list all test files and the line-level issues where test case declaration comments violate the required format.

Frequently Asked Questions about R008: 用例声明格式不规范

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate JSDoc format for XTS test case declarations?

To validate XTS test case JSDoc format, scan `.test.ets`, `.test.ts`, and `.test.js` files to check that comment blocks use the `/** ... */` structure and each line starts with `*`.

What is the correct format for @tc.name and @tc.number tags in test files?

The correct format for `@tc.name` and `@tc.number` tags requires using the `@` modifier with whitespace separation, disallowing incorrect separators such as `:` before the tag values.

How do I check for empty lines between JSDoc and it() in ArkTS test files?

Check for empty lines between JSDoc and `it()` by scanning test files to verify the doc comment closing `*/` ends immediately before the `it('...')` declaration without unintended gaps.

Does static analysis detect malformed JSDoc comments in .test.ets files?

Static analysis detects malformed JSDoc comments in `.test.ets` files by enforcing the `/** ... */` structure, per-line `*` prefix, and correct `@tc.*` tag formatting with whitespace separation.

What are the limitations of scanning test case documentation format violations?

Scanning test case documentation format violations is limited to files with extensions `.test.ets`, `.test.ts`, and `.test.js`, targeting only JSDoc blocks placed before `it('...')` declarations.

Why does my XTS test case JSDoc block trigger a format warning?

Your XTS test case JSDoc block triggers a format warning if it violates required rules like missing per-line `*` prefixes, incorrect `@tc.*` tag separators, or empty lines between `*/` and `it(`.