If your question is about SonarLint in the IntelliJ Platform, VS Code, Visual Studio, or Eclipse, please post it in that sub-category.
Otherwise, please provide:
- Operating system: Fedora 40
- IDE name and flavor/env: Visual Studio Code
- Sonar Lint VSCode Version: 4.11
And a thorough description of the problem / question:
SonarLint is showing a false positive on the following example:
let step;
try {
step = 1;
operation1();
step = 2;
operation2();
...
} catch (something) {
LOG.message(`Failed in step ${step}`);
}
The error sonarlint(typescript:S1854)
is shown on line step = 1;
and it shouldn’t be as the value is possibly used in the catch
block.