which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): Community Edition, Version 9.9 (build 65466)
how is SonarQube deployed: AWS EC2
Summary: If a property is declared on a json object, but undefined, sonar should detect the rule S2259, but doesn’t, if the json object is used within a function which calls the undefined property, there’s an error which sonar should have detected.
const testObject = {
foo: "bar",
marco: "polo",
arg1,
};
function test(object) {
let a = b + object.arg1
console.log(a)
}
test(testObject)
Hello @ilia ! sorry for the delay, I was hoping Sonar would mark line 4 as a S2259 bug
I also realized there’s an extra bug on the small snippet, it should have also pointed out in line 8 the variable b as another bug of undefined variable.
The analyzer does not support cross-file analysis, therefore we won’t raise an issue for variables that were not declared inside the file. They might be global.