Skip to content

Commit 720ca7f

Browse files
author
Vibe Bot
committed
Address review comment from sonar-review-alpha on packages/jsts/src/rules/S125/rule.ts
Comment: The `/i` flag is too broad for `NOTE` (and to a lesser extent `HACK`). Both are common English prose words. A comment block like: ``` // Note that we disabled this temporarily. // const x = processVector(name, type); ``` will match `\bNote\b` (case-insensitive), `containsCode` returns false for the first line, so `hasTaskMarker` returns `true` and the genuine commented-out code is silently suppressed. `TODO`, `FIXME`, and `XXX` are almost never used as natural English prose in comments, so `/i` is low-risk for those. `NOTE` is different — it appears constantly in developer prose (`// Note that...`, `// Note:`, `// NOTE:` are all equivalent under `/i`). Remove the `/i` flag and match uppercase only, which is the de-facto convention for all five task markers. The `@TODO` test case still passes because `\b` matches before the `T` in `@TODO`. If lowercase support is truly needed, enumerate the exact mixed-case forms you want rather than accepting all cases. - [ ] Mark as noise
1 parent 659bfb9 commit 720ca7f

File tree

1 file changed

+1
-1
lines changed
  • packages/jsts/src/rules/S125

1 file changed

+1
-1
lines changed

packages/jsts/src/rules/S125/rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import path from 'node:path';
2828

2929
const EXCLUDED_STATEMENTS = new Set(['BreakStatement', 'LabeledStatement', 'ContinueStatement']);
3030

31-
const TASK_MARKER_PATTERN = /\b(TODO|FIXME|HACK|XXX|NOTE)\b/i;
31+
const TASK_MARKER_PATTERN = /\b(TODO|FIXME|HACK|XXX|NOTE)\b/;
3232

3333
// Cheap prefilter: any meaningful JS statement must contain at least one of these characters,
3434
// or be an import/export with a string literal (side-effect imports have no punctuation)

0 commit comments

Comments
 (0)