GHGHGHKO
(HG_Ko)
December 12, 2022, 11:06am
1
Please provide
Operating system: Windows 10
SonarLint plugin version: 6.8.0.50884
Programming language you’re coding in: kotlin
Is connected mode used:
Connected to SonarCloud or SonarQube (and which version): Sonarlint with Intellij
And a thorough description of the problem / question:
github : memes-api/SignService.kt at master · GHGHGHKO/memes-api · GitHub
fun signIn(signInRequestDto: SignInRequestDto): SignInResponseDto {
val user: UserMaster = userMasterRepository.findByEmail(signInRequestDto.email)
?: throw UserNotFoundExceptionCustom()
if (!passwordEncoder.matches(signInRequestDto.password, user.password)) {
throw EmailSignInFailedExceptionCustom()
}
val jwtInfo = jwtTokenProvider.createToken(user.id.toString(), user.roles)
return SignInResponseDto(
jwtInfo.token, jwtInfo.expirationDate
)
}
user
variables is Unused local variables should be removed
ganncamp
(G Ann Campbell)
December 13, 2022, 1:02pm
2
Hi,
Welcome to the community!
It looks like SonarLint 6.8 has some age on it at this point. Could you upgrade to the current version, 7.2.1.58118, and see if this is replicable?
Thx,
Ann
1 Like
GHGHGHKO
(HG_Ko)
December 14, 2022, 10:17am
3
Hi, G Ann Campbell!
Thank you for your reply
Updated from version 6.8
to version 7.2.1.58118
See this issue is replicated
Is it because didn’t return a variable?
ganncamp
(G Ann Campbell)
December 14, 2022, 12:40pm
5
Hi,
Thanks for trying with the updated version. Unfortunately, I can’t answer your question, so I’ve flagged this for more expert eyes.
Ann
GHGHGHKO
(HG_Ko)
December 14, 2022, 1:47pm
6
Hi,
Thanks for the quick reply!
I’m looking forward to awesome results!
1 Like
Hello @GHGHGHKO ,
Thanks for your report. I was able to reproduce this issue when analyzing the single file. However, when I analyze the whole project, this issue disappears. This means that the problem is that SonarLint wasn’t able to locate the .class files of your project correctly. And without semantics, the analyzer is not able to resolve variables, types, and bindings correctly, which leads to the incorrect result.
For now, I can suggest you build your project with Gradle (either from the IDE or command line), make sure that the build
folder is generated, and then run the analysis. The issue should disappear.
Meanwhile, I created a ticket to not report FPs in case of incomplete semantics:
https://sonarsource.atlassian.net/browse/SONARKT-269
Kind regards,
Margarita
1 Like
GHGHGHKO
(HG_Ko)
December 26, 2022, 1:36pm
10
Hello Margarita Nedzelska,
Thanks for the quick comment and explaining the problem!
Thanks for issuing the tickets.
I’ll be checking the ticket!
HG_Ko
system
(system)
Closed
January 2, 2023, 1:36pm
11
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.