SonarQube declares a Bug for Funtion non-existance whereas it exisits

I have a sonarQube project where I see redline on a line as follows
var current_url = checkURL(location.href);
in a javascript file, lets say file.js

The redline is under the function checkURL where it exists in another javascript file in another directory, lets say scripts/file2.js or even in the same directory, to sanitize the url, which works fine. Clicking on it in sonarqube UI, it indicates

“checkURL” does not exist. Change its name or declare it so so that its usage doesn’t result in a “ReferenceError”. Why this is an issue

The question why this declaration as a bug? Does this means that sonarqube is not capable of detecting functions calls in different Javascipt files?

Hi,

What version of SonarQube are you using? In case you’re not sure, you can find the version number in the page footer.

 
Ann

Hi Ann, Community edition - Version 8.9.6 (build 50800)

Hi,

Thanks for that.

By default, I believe analysis is scoped to the file. In the 9-series we’ve worked on cross-file bug detection, which would conversely eliminate some cross-file false positives.

If you believe the function is truly available from the other file, I would just mark this False Positive.

 
HTH,
Ann