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

Add additional logs when embedded Node.js is not available #4618

Merged
merged 3 commits into from Mar 26, 2024
Merged

Conversation

zglicz
Copy link
Contributor

@zglicz zglicz commented Mar 25, 2024

Fixes #4563

As described in the task, we add the following logs:

  1. Debug information, that the user platform is not supported
  2. When the version of Node.js is unsupported, mention the possibility of setting it via the sonar.nodejs.executable property

Testing:

  1. Augmented unit tests to verify that the logs get triggered
  2. Manual test
  • Build SonarJS
  • Download SonarQube and copy the produced .jar into SonarQube extensions folder
  • Change local Node version to 16
  • Run Scanner on small JS project and observe in logs:
  • 15:12:24.947 DEBUG: Your platform is unsupported for embedded Node.js. Falling back to host Node.js.
  • 15:12:28.081 ERROR: Error during SonarScanner execution
    java.lang.IllegalStateException: Error while running Node.js. A supported version of Node.js is required for running the analysis of JS/TS files. Please make sure a supported version of Node.js is available in the PATH or an executable path is provided via 'sonar.nodejs.executable' property. Alternatively, you can exclude JS/TS files from your analysis using the 'sonar.exclusions' configuration property. See the docs for configuring the analysis environment: https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/languages/javascript-typescript-css/

Copy link
Contributor

@vdiez vdiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@zglicz zglicz merged commit 3e0b6d3 into master Mar 26, 2024
16 checks passed
@zglicz zglicz deleted the i4563 branch March 26, 2024 08:18
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

Successfully merging this pull request may close these issues.

Improve logs when Node.js embedded is not usable in host
2 participants