-
What language is this for?
JavaScript/TypeScript -
Which rule?
Multiple consecutive calls to methods that accept multiple arguments should be combined (typescript:S7778) -
Why do you believe it’s a false-positive/false-negative?
It reports a problem when dealing with methods that don’t accept multiple arguments -
Are you using
- SonarQube Cloud?
Yes - SonarQube for IDE - which IDE/version?
VS Code 1.109.4
SonarQube for IDE v4.44.0
- SonarQube Cloud?
-
How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
class CustomClass {
private internalStore: number = 0;
public push(item: number): void {
this.internalStore += item;
}
}
const instance = new CustomClass();
instance.push(1);
// Error: "Do not call `Array#push()` multiple times. sonarqube(typescript:S7778)"
instance.push(2);
The second .push call causes a false positive, as the method doesn’t accept multiple arguments, therefore it must be called multiple times.