EdwinOtten
(Edwin Otten)
1
- What language is this for?
- Which rule?
- Why do you believe it’s a false-positive/false-negative?
- I am using
- How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
- Validate some code that violates S2301 and look at the code example
The code example given for S2301 is a bit inappropriate in my opinion. See code here: SonarJS/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2301.html at master · SonarSource/SonarJS · GitHub
ganncamp
(G Ann Campbell)
3
Hi,
Welcome to the community and thanks for this report!
Could you provide a code sample that you feel would be appropriate?
Thx,
Ann
EdwinOtten
(Edwin Otten)
4
I suggest something that doesn’t doesn’t use a combination of the words “tempt” “child” and “offerCandy”.
An alternative could be:
function feedHuman(name: string) {
offerSushi(name);
}
function feedAnimal(name: string) {
offerCarrot(name);
}
// ...
function feed() {
isHuman ? feedHuman("Joe") : feedAnimal("Joe");
}
2 Likes
ganncamp
(G Ann Campbell)
5
Hi,
Thanks for that. I’ve queued this for the language folks.
Ann
1 Like
ilia
(Ilia)
7
Hello Edwin,
Thank you for your feedback. I have opened a ticket to track this: JS-516