Which product(s) you’re using
Spring Tool Suite 4 4.21 ,sonarlint plugin 9.1-9.2
Which language you’re analyzing
Java
Which rule is affected
S6833
Why you believe it’s a false-positive / false-negative
in my class ,NOT ALL methods are annotated with @ResponseBody.
and sonarlint still raise an issue
We also need you to include a code sample
Contribute to yanggaojun101/sonarlint development by creating an account on GitHub.
package com.example.demo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping(value = { "/web" })
public class WebController {
@GetMapping
public Object loginpage() {
return "login";
}
@PostMapping(value = "/login")
@ResponseBody
public Object login() {
return null;
}
}
Colin
(Colin)
January 5, 2024, 10:29am
2
Hey there.
I’ve moved your post to the section on 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 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.
…
Can you please review this post and include the required information, such as a text-based reproducer (not a screenshot of code)?
Hi @yanggaojun101 ,
Welcome to the community,
Thank you for reporting this false positive. I don’t know how we miss it when implementing the rule. I have created a ticket to fix it and you can track its progress here . For now, you can mark the issue as an FP.
hi colin,
Is this false-postivie fixed ?
I find the ticket no progress
https://sonarsource.atlassian.net/browse/SONARJAVA-4748
Colin
(Colin)
April 9, 2024, 9:39am
11
It hasn’t been worked on yet.
Hello,
The ticket is done and the fix will be available on SonarQube Cloud soon, and included with the release of SonarQube Server 2025 Release 3.