Skip to content

Conversation

@zglicz
Copy link
Contributor

@zglicz zglicz commented Jan 7, 2026

Summary

  • Fix false positive in S3801 when a function ends with a call to a never-returning function
  • The rule now recognizes that calling a function with return type never (e.g., a throwing helper) terminates the code path
  • Requires the called function to have an explicit : never return type annotation (TypeScript infers void for unannotated throwing functions)

Test plan

  • Added valid test cases for calling never-returning functions
  • Added invalid test case for calling throwing function without : never annotation (documents limitation)
  • All existing tests pass

🤖 Generated with Claude Code

When a function ends with a call to another function that returns `never`
(e.g., a throwing helper), the rule now recognizes this as a terminating
path and does not flag it as an inconsistent return.

Note: This requires the called function to have an explicit `: never`
return type annotation, as TypeScript infers `void` for functions that
only throw without annotation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@hashicorp-vault-sonar-prod
Copy link

hashicorp-vault-sonar-prod bot commented Jan 7, 2026

JS-106

🤖 Generated with GitHub Actions
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

Ruling Report

Code no longer flagged (7 issues)

S3801

ace/lib/ace/mode/html/saxparser.js:5100

  5098 | };
  5099 | 
> 5100 | TreeBuilder.prototype.insertIntoFosterParent = function(node) {
  5101 | 	var tableIndex = this.openElements.findIndex('table');
  5102 | 	var tableElement = this.openElements.item(tableIndex).node;

ace/lib/ace/mode/json/json_parse.js:106

   104 |         },
   105 | 
>  106 |         number = function () {
   107 | 
   108 | // Parse a number value.

ace/lib/ace/mode/json/json_parse.js:147

   145 |         },
   146 | 
>  147 |         string = function () {
   148 | 
   149 | // Parse a string value.

ace/lib/ace/mode/json/json_parse.js:199

   197 |         },
   198 | 
>  199 |         word = function () {
   200 | 
   201 | // true, false, or null.

ace/lib/ace/mode/json/json_parse.js:229

   227 |         value,  // Place holder for the value function.
   228 | 
>  229 |         array = function () {
   230 | 
   231 | // Parse an array value.

ace/lib/ace/mode/json/json_parse.js:256

   254 |         },
   255 | 
>  256 |         object = function () {
   257 | 
   258 | // Parse an object value.

desktop/app/src/ui/local-changes-overwritten/local-changes-overwritten-dialog.tsx:157

   155 |    * Returns a user-friendly string to describe the current retryAction.
   156 |    */
>  157 |   private getRetryActionName() {
   158 |     switch (this.props.retryAction.type) {
   159 |       case RetryActionType.Checkout:

Ruling has been updated. To re-run CI, either:

  • Close and reopen this PR, or
  • Run: git pull && git commit --allow-empty -m 'Trigger CI' && git push

@zglicz zglicz closed this Jan 7, 2026
@zglicz zglicz reopened this Jan 7, 2026
@sonarqube-next
Copy link

sonarqube-next bot commented Jan 7, 2026

@zglicz zglicz enabled auto-merge (squash) January 8, 2026 13:05
@zglicz zglicz merged commit 32ae309 into master Jan 8, 2026
252 of 318 checks passed
@zglicz zglicz deleted the js-106-never-returning-functions branch January 8, 2026 13:06
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.

2 participants