Diva11
(Diva11)
March 9, 2022, 10:39am
#1
SonarQube raises this as code smell
The validate function of this module
requires to return either false or custom error message.
Doing this is flagged as an error in Sonar
Return same type of value.
Need to mark this as false positive.
Example
If(someCondition)
{Return true
}
Return ‘Please satisfy the condition’
Colin
(Colin)
March 9, 2022, 10:42am
#2
Hey @Diva11
Please read this thread regarding reporting false-positives:
Hey SonarSource Community!
False-positives happen , as do false-negatives, and we’re eager to fix them. We are thrilled when our users report issues so that we can make our products better.
What is a false-positive?
A false-positive is when an issue is raised unexpectedly on code that should not trigger an issue, or where the suggested action doesn’t make any sense for the code.
What is a false-negative?
A false-negative is when an issue should be raised on a piece of code, but isn’t.
There…
In any case, any user with Administer Issues permissions on a project should be able to mark the issue as a false-positive in the UI.
Diva11
(Diva11)
March 18, 2022, 1:44pm
#3
We dont have admin privileges througout, we need to work on a solution through yaml file in our node ja project… can you please help
Diva11
(Diva11)
March 18, 2022, 1:45pm
#4
How can we exclude this from sonar check altogether