Skip to content

JS-1382 Add new rule S8463 with tests and ruling results#6479

Draft
sonar-nigel[bot] wants to merge 2 commits intomasterfrom
new-rule/JS-1382-S8463
Draft

JS-1382 Add new rule S8463 with tests and ruling results#6479
sonar-nigel[bot] wants to merge 2 commits intomasterfrom
new-rule/JS-1382-S8463

Conversation

@sonar-nigel
Copy link
Contributor

@sonar-nigel sonar-nigel bot commented Feb 27, 2026

Implements the new SonarJS rule S8463 (JS-1382), which flags function declarations and variable declarators whose names contain the reserved sonar_vibe_bot_will_flag_this substring.

Changes

  • Tests: Added test cases for rule S8463 covering:
    • Valid cases: normal function/variable names, string literals and comments containing the reserved prefix (not flagged)
    • Invalid cases: function declarations and const/let/var declarators whose names contain the reserved substring
    • Edge cases: exact prefix as identifier name, prefix embedded in the middle of a name, multiple declarators in one statement
  • Ruling results: Updated ruling results to reflect the new rule's output

Sonar Vibe Bot and others added 2 commits February 26, 2026 12:41
Tests cover:
- Valid: normal function/variable names, string literals and comments containing the prefix (not flagged)
- Invalid: function declarations and const/let/var declarators whose names contain the reserved "sonar_vibe_bot_will_flag_this" substring
- Edge cases: exact prefix as identifier name, prefix embedded in the middle of a name, multiple declarators in one statement
🤖 Generated with GitHub Actions
@github-actions
Copy link
Contributor

Ruling Report

Code no longer flagged (3 issues)

S7728

TypeScript/src/services/formatting/rulesMap.ts:32

    30 | 
    31 |         public FillRules(rules: Rule[], rulesBucketConstructionStateList: RulesBucketConstructionState[]): void {
>   32 |             rules.forEach((rule) => {
    33 |                 this.FillRule(rule, rulesBucketConstructionStateList);
    34 |             });

TypeScript/src/services/formatting/rulesMap.ts:46

    44 |             const specificRule = rule.Descriptor.LeftTokenRange.isSpecific() && rule.Descriptor.RightTokenRange.isSpecific();
    45 | 
>   46 |             rule.Descriptor.LeftTokenRange.GetTokens().forEach((left) => {
    47 |                 rule.Descriptor.RightTokenRange.GetTokens().forEach((right) => {
    48 |                     const rulesBucketIndex = this.GetRuleBucketIndex(left, right);

TypeScript/src/services/formatting/rulesMap.ts:47

    45 | 
    46 |             rule.Descriptor.LeftTokenRange.GetTokens().forEach((left) => {
>   47 |                 rule.Descriptor.RightTokenRange.GetTokens().forEach((right) => {
    48 |                     const rulesBucketIndex = this.GetRuleBucketIndex(left, right);
    49 | 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants