Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotspots aren't retrieved from Sonarqube 7.9 #154

Closed
ctrung opened this issue Oct 20, 2022 · 4 comments
Closed

Hotspots aren't retrieved from Sonarqube 7.9 #154

ctrung opened this issue Oct 20, 2022 · 4 comments

Comments

@ctrung
Copy link

ctrung commented Oct 20, 2022

Hi,

There's a regression in Sonarqube's version detection algorithm when dealing with hotspots retrieval.

Using Sonarqube 7.9.1 (build 27448) and sonar-report 3.0.6, semver module is not working as intended.

When I add the following debug lines :

  console.error("semver.satisfies(version, \"<7.3\")=%s", semver.satisfies(version, "<7.3"));
  console.error("semver.satisfies(version, \">=7.3 && <7.8\")=%s", semver.satisfies(version, ">=7.3 && <7.8"));
  console.error("semver.satisfies(version, \">=7.8 && <8.2\")=%s", semver.satisfies(version, ">=7.8 && <8.2"));

  console.error("version < \"7.3\"=%s", version < "7.3");
  console.error("version >= \"7.3\" && version < \"7.8\"=%s", version >= "7.3" && version < "7.8");
  console.error("version >= \"7.8\" && version < \"8.2\"=%s", version >= "7.8" && version < "8.2");

Here's the output :

sonarqube version: 7.9.1.27448
semver.satisfies(version, "<7.3")=false
semver.satisfies(version, ">=7.3 && <7.8")=false
semver.satisfies(version, ">=7.8 && <8.2")=false
version < "7.3"=false
version >= "7.3" && version < "7.8"=false
version >= "7.8" && version < "8.2"=true

Result : execution path is always entering the else clause (https://github.com/soprasteria/sonar-report/blob/master/index.js#L195) and "to review" status hotspots in Sonarqube 7.9.1 are not found in the generated report.

thecampagnards pushed a commit that referenced this issue Oct 27, 2022
@thecampagnards
Copy link
Member

Hello,
I released the 3.0.7 I did some tests it look good.
Can you confirm ?

@ctrung
Copy link
Author

ctrung commented Oct 28, 2022

Hi,

The fix does not work, at least on my instance of SonarQube. As you can see in the logs, mine returned a version of 7.9.1.27448 which does not respect semver convention strictly speaking.

Just made some tests based on what is in version = json.version (L.168) :

  • 7.9.1 : semver.satisfies(version, "7.8 - 8.2") returns true
  • 7.9.1.27448 : semver.satisfies(version, "7.8 - 8.2") returns false 😢

@thecampagnards
Copy link
Member

thecampagnards commented Oct 31, 2022

Hi,
My bad,
With this version it should be good https://github.com/soprasteria/sonar-report/releases/tag/3.0.8
I used semver.coerce to reformat the error:

semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'

@ctrung
Copy link
Author

ctrung commented Nov 2, 2022

Thx for your hardwork !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants