How to Report a False-positive / False-negative

Hey SonarSource Community!

False-positives happen, as do false-negatives, and we’re eager to fix them. We are thrilled when our users report problems, so we can make our products better.

What is a false-positive (FP)?

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 (FN)?

A false-negative is when an issue should be raised on a piece of code, but isn’t.

There are some things we’d like from you to make sure the information you provide is complete, and so that we can work efficiently.

Relation between reported issues

What information should I include?

When reporting a false-positive or a false-negative, make sure to tell us…

Which product(s) you’re using

  • SonarQube Server (formerly SonarQube) or SonarQube Community Build (formerly SonarQube Community Edition)
    • If so, which version?
  • SonarQube Cloud (formerly SonarQube Cloud)
  • SonarQube for IDE (formerly SonarLint)
  • If yes, with which IDE and which version?
    • If you’re using Connected Mode, tell us with which product (if it’s SonarQube Server / SonarQube Community Build, see the above notes on providing version details)

:warning: When possible, please try and reproduce the issue using the latest releases of our products. You might get lucky! Our products are continuously improving, and investigating an issue we’ve already fixed isn’t fun for anybody. Your report is much more likely to get attention if you are using a fresh release.

Which language you’re analyzing (and tag your post with the language!)

We’re looking at a lot of code all day. Let us know if it’s Java, C#, Python, COBOL…

Tagging your post with the right language will make it more likely to draw the attention of the right team, and other tags (like security for vulnerability rules) also help us!

Which rule is affected

The title of the rule can be enough, but the Rule ID is even better (E.G. S1234)

Why you believe it’s a false-positive / false-negative

Even if you think it’s obvious, take the time to explain why an issue should or should not be raised.

We also need you to include a code sample

This code sample should either be:

  • code-as-text. Not a screenshot of code or a screenshot of the issue
  • Or a link to code that raises the issue (or doesn’t) on a public SonarQube Cloud project

The more complete a code sample, the easier it will be for us to reproduce and figure out where the issue is. At the same time, it should only be the code that is necessary to reproduce the issue.

Recognizing the varying levels of effort it can take to provide a code sample, here is our order of preference for how the code sample is provided.

  • For C#, Java, and C/C++: a minimal sample project with everything needed to build/analyze (a Maven project, a Visual Studio solution, etc.)
  • A single file (or the full content of a file wrapped with triple quote ``` for proper formatting) where the false-positive is raised, or where an issue isn’t raised in the case of a false-negative.
  • A well-formatted excerpt of code (make sure this excerpt still raises the issue)

Please also leave a comment in the code where the false-positive is being raised, or where the false-negative should be reported and isn’t.

Advanced Tips

It’s possible your false-positive / false-negative has already been reported! Searching our public issue trackers by Rule ID is a good way to find out.

ABAP
Apex
C#
C/C++/Objective-C
COBOL
Flex
Go
HTML
Java
Javascript / Typescript / CSS
Kotlin
PHP
Python
RPG
Ruby
Scala
Swift
VB.NET
VB6
XML

If you find a similar issue and still have some doubts, go ahead and report it to us.

Thanks again for helping us make our products better!

10 Likes
Report a False-Positive
False positive S1172 Sonar Lint
False positive when using Pattern Matching
[Java:S2589] Ignore for Boolean equals
Incorrect `no-built-in-override` report from imports
FP: S2970 with AssertJ / SoftAssertions / Field Injection
Why null check not working before method call?
`no-reference-error` reports global variables
java:S5778 detects false runtime exception
javascript:S2259 detection error
Escapeshellarg for php for execution system call like exec($cmd)
DotNet alert for multiple evaluation of an IEnumerable?
False positive in SonarLint
Sonarqube doesn't detect non-compliant code from rules
[c] Out of bound memory acess not detected in for loop
Rule java:S2629 not reporting the problems
Scala Language, implicit: False reported "Code Smell" issue "as unused code"
Scanning lambda function based code in SonarQube
[javasecurity:S6096] Zip slip reported when prevented using Java NIO
Error in tainted data analyze
[javasecurity:S6096] Zip slip not reported when unzip is done using Java NIO
S3546: False-positives happen when using nested try-cache-finally
FP S2699: Tests should include assertions - NSubstitute
False positive for java:S1172 in a graphQL Api service
php:S3699 reports a false positive when an expression has a return type `never`
java:S3516 Error detection
S2068 "password" flagged in XML incorrectly
[Webinar] Scaling Clean Code Across Your Enterprise
Sonar does not accept null check via method
SonarLint for JetBrains IDEs: false positive for unused import in Vue 3 with <script setup>
S5145 possible false positive with log4j2
SonarCloud is not detecting vulnerabilities of the Project
Refactor function to return same type
java:S2583 should not apply for lombok `@NonNull` annotation
SonarQube is unable to detect SQL Injection
Define a constant instead of duplicating this literal "SQL STATEMENT" n times
Jquery-1.8.3 hit Loops should not be infinite rule
About the Report False-positive / False-negative... category
Default Guid Equals
Sonarlint python:S5361
FP S1848: Incorrect detection for CDK constructs
On the vue3 project, defineProps and defineEmits should be automatically available in <script setup>
Inquirer.js command line validate function
Hundreds of obvious false positives
S1848: CDK new object reported as "useless" code, false positive
SonarCloud doesn't recognise classes like CollectionUtils
secrets:S6703 & java:S6437 using Ansible variable with double curly brackets
Variable wrongly marked as not used for walrus operator
Rule cpp:S836 reports a bug without a reason
False positive null pointer C#
Java 21 pattern matching false positives
SQLi not detected
The setString method leads to a false positive
JUnit5 Cucumber runner is detected as test class without tests
Sonar cloud props validation issue
terraform:S6329 fires incorrectly
Is this OWASP issue a false positive?
BUG: false positive invalid pseudo-class selector in .vue files
False Positive on javasecurity:S6096 when using java.nio.file.Files.createTempFile
I had a error in sonarqube..Help me to fix it
False positive for Python Flask 2.2, unexpected named argument, Flask.send_file 'dowload_name'
What is the way around to including files in PHP instead of using include or require_once
False-Negative for a QT project
Deadcode not flagged when part of new code block
False Positive - Nullable pointer is passed to a callee that requires a non-null 1st parameter
Rule 'Disabling CSRF protections is security-sensitive' does not seem to be working
csharpsquid:S6966 should not be given for DbContext.Add
The assert macro caused a false positive
java:S6204 incorectly reports modifiable list as needs to be unmodifiable
SonarQube reporting duplicate code for database entities
Bug - Dispose pattern - csharpsquid:S3881
Dependencies should not have "system" scope
java:S2111 - "BigDecimal(double)" should not be used
SonarQube Quality-Profile rules S1258 reporting Incorrectly as part of QualityGate scan
SonarLint for C# doesn't complain about Nullable access
False positive on rule javascript:S3827 for globalThis
Possible false-positive in tainted value analysis
False positive asyncio.run loop_factory
Sonarlint in CLion falsely gives C++ issues on code enclosed in extern "C"{}
8.45.0.54064 many false positives with "xx is null on at least one execution path"
False positive java:S1874
FP after all Spring 5 org.springframework.util.Assert validation methods
kotlin:S6311 raises a false-positive for Android ViewModel coroutines usage
NullPointerException detected after Asserts.check() and Args.check()
False positive java:S2259: NullpointerException
In the patch there is unused variable major sonar issue, but sonarQube does not show the issue
Sonar wrongly flags code as SQL spacing bugs
Replace this <i> tag by <em>
Sonar doesn't detect Vue3 naming scheme for directives [Typescript]
Fix bug that label constants within a CaseLabelTree must be counted
S3900 warnings and extension methods
Solve Sonar issue in simple getter and setter methods with Date or List
java:S6204 does not recognize Collections.shuffle as a mutator
Java java:S101 for ListResourceBundle
C# False positive csharpsquid:S3903
S1854 FP - Remove this useless assignment to local variable
.NET 8 and C# 12 support
Rule java:S6814 "Optional REST parameters should have an object type" false positive
Why I'm getting Hard coded password found here?
False Positive S2583
SonarCloud C++ False positive on naked new
S3172 False-positive, pattern matching switch expression, deems it a chain
Incorrect application of "Move constants defined in this interfaces to another class or enum."
Remove this unused method parameter reported when method called via method reference only
False positive Use try-with-resources or close this "ObjectInputStream" in a "finally" clause
Post Upgrade to LTS, there is a spike in Vulnerabilities Reported
Scan failing only on run triggered by Merging a PR
False positive with inner TheoryData classes
False Positive in Methods return value
False positive on cpp 3927
Terraform rule terraform:S628
False positive on casting size_t cpp:S1905: Redundant casts should not be used
I get a "Handle the following exception that could be thrown by ..." false positive
Sonar is destroying my job and it's driving me to despair
Sonar reported error “I/O function calls should not be vulnerable to path injection attacks”
False positive for "Mouse events should have corresponding keyboard events"
Sonar scanning not catching the issues reported by Microsoft Scanning
After Optional.orElseThrow(),"userInfo" is not nullable
CSharp - 3885 - No solution possible when used in AssemblyResolve event
FP: magic number where no number is used
Issue with aria hidden for input type hidden
I wrote ObjectUtils.isEmpty, why does it say I get NullPointerException?
FN on S5863: Compare an object to itself with AssertJ / SoftAssertions
Switch expression S2589 False postive or Documentation gap
Variable assignment falsely claimed to be null
Replace the use of void in an inheritted method override
[java:S1170] FP when field is initialized by static input
SonarCloud - False positive Web:S5254 with Thymeleaf
[JAVA] False Negative S2755
False positive S1172 for constructor parameter
False positive for plsql:DeleteOrUpdateWithoutWhereCheck SonarQube 8.9.6
Possible FP for java:S2924: @TempDir declared in super class
Vulnerability false positive for Blob Storage Emulator account key
Change this condition so that it does not always evaluate to 'True'
False positive for 'switch case clauses should not have too many lines of code'
False positive "The constructor is undefined" in Enums with AllArgsConstructor
[kotlin:S1144] kotlin.Suppress Annotation does not act the same as java.lang.SuppressWarnings
Rule java:S1854 Recognition exception!
C# tuple destructuring misidentified as bug by SC
S2583 gives a false positive
Media elements such as <audio> and <video> must have a <track> for captions.I added track also and i
Incorrect code smell java:S4276 requested to use the specialized IntPredicate
Autocomplete attribute issue
`sonarjs/todo-tag` can not be disabled with `eslint-disable-next-line`
False positive java:S6832
java:S6857 false positive when using @Value to inject directly into a Map
False positive recursive method with lombok
S6967 - ModelState.IsValid not needed for JsonResult
Private variable referred in Kafka publish through setter is marked as unused variable - java:S1068
Rule cpp:S4998 false positive for overriden functions
Make sure the use of "ACCESS_FINE_LOCATION" permission is necessary
Lombok Custom Builder
False positive for typescript:S6754, not taking into account title-capped variable names
java:S6857 false positive when supplying a JNDI environment var
False positive for S1172
S6829 when constructor to be injected has no arguments
React fuse template custom css properties
'Remove this "===" check; it will always be false" false positives
S2095: Exception thrown between open and close, the resource is not closed
Introducing 7 new rules for React which detect bugs in JS/TS code
Ignore void-use for promises in sonarlint
Only two cases does not cause error
S5644 (ItemOperationsTypeCheck) false positive when using python3.12 generic syntax
S5852 doesn't detect ReDoS in simple RegEx pattern
Seems C++17 related rules are sometimes applying to C++14
When it comes to cross-file method invocation, false positives may occur
SonarQube not detecting hard-coded record ids in Apex
java:S3242 false positive using SequencedCollection when order is significant
Rel noopener issue on window.open
False positive for SecureRandom
SonarQube no longer reporting vulnerabilities related to external entities for xml parsing
False positive: for-loop in template class
Try-with-resources should be used - Rule ID:java:S2093 - Potential False Negative - Java
S5334 - Express dynamic route parameters when passed in React calls are not detected
Boxed boolean from a hashMap
S2699 false positive when using Roslyn Analyzers test framework
Names of regular expressions named groups should be used for self reference
False NullPointerException detection using Spring Assert.notNull
S6853 not recognising asp-for
False Positive terraform:S6281
java:S6809 does not recognize surrounding transaction
S1126 decreases readability in methods using guards
Kotlin equals() "Add a type test to this method"
objc:S1854 false positive, used variable labelled as unused since recent update
Codeclimate + sonar java + lombok -> False positives
Replace switch statement by if statements to increase readability in Java 14+
Boolean Angular Pipes Trigger S2301
java:S6809 does not recognize surrounding transaction
New Rule for C# and VB.NET - Locks should be released!
False Negative: Arbitrary JSON file read in nodeJS
Sonarqube is not covering the NULL pointer check
FP S6555 Null pointers should not be dereferenced
FP Javabugs S6651 Conditionally executed code should be reachable
Angular html template dynamic attributes being incorrectly flagged
False positive cpp:S1271 when I use templeate parameter of type size_t
SonarQube flags Emotion's css attribute as unknown property
Add a way to break out of this method's recursion
Unused variables are not reported
False positive: kotlin:S6619
S6735 False positive when evaluating pandas.merge having right_on and left_on as parameters (take 2)
C# try-catch-finally
kotlin:S1862 Guard conditions in when expression/statement
Tests using not operator incorrectly identified as not including assertions
FP when adding Serializable Record to a session
java:S4488 FP with @RequestMapping on a class
False-Positive csharpsquid:S3459 When using Blazor @ref
typescript:S2301 false positive
Incorrect Lint Warnings on Kotlin (kotlin:S6619, kotlin:S1128)
python:S1542 rule partially working
Over-riding rule parameter in custom quality profile not working for GitHub Actions rule S7637
FP Java S2693 & S1171 Threads should not be started in constructors (anonymous classes)
Java:S6833,false-positive with @RestController
Sudden Increase in Bugs and Errors indications
Vb.net vulnerabilities are not populating any security issues on sonarqube server
java:S3655 Optional#isPresent()
cpp:S5950 falsely triggered
Java record with a validating constructor
In JavaScript, don't suggest const for variables that are filled in subsequent .forEach loops with attribute accessors
java:S3305 don't report field if bean creation method is used i multiple places
java:S2162 - Hibernateproxy check is valid
FP: Use stronger SSL and TLS versions with curl_easy_init()
S7728 FP Use “for…of” loops instead of “forEach” method calls when object is not an iterable type
Improve Rule kubernetes:S6864
org.springframework.lang.Nullable is ignored in nullability analysis
FP on java S5164: ThreadLocal#remove not detected when JsonNode is type of ThreadLocal
"Dependencies should be explicit" issue is coming for package.json modules
Critical issue "Possible null pointer dereference in xxx " about reactor framework
The return value must be used
SonarCloud does not detect command injection problems
Loops should not be infinite (javascript:S2189)
Does java:S122 count a curly brace?
S4158: "Empty collections should not be accessed or iterated" False positive with local method
Rule doesn't take into account the Spring applicationcontext.xml file
java:S107 should ignore @jakarta.inject.Inject
AWS access key id false positive in Kotlin variable name
Support unused variables on list() + explode() or big array
False positive with PHP strtok()
Unused local variables does not play nicely with JSX
False positive `display` shadows a builtin
[java:S1450] Assigned in one method, read on the other