Scan fails on JS/TS if the IDE is running on Windows and the project files are on the WSL2 share

When the JS/TS files are on a WSL2 share, the scan fails and reports nothing.

  • Windows 11
  • IntelliJ IDEA 2022.2.1 (Ultimate Edition)
  • Project on WSL2
  • Offline mode (Not connected to SonarQube or SonarCloud)

The configuration of the plugin requires having nodejs on windows. It is not possible to choose the node located on WSL2.

Trigger: ACTION
[Action] 1 file(s) submitted
Configuring analysis with org.sonarlint.intellij.java.JavaAnalysisConfigurator
Analysing 'StreamProcessor.ts'...
Starting analysis with configuration:
[
  baseDir: \\wsl$\Ubuntu\home\mabid\Projets\wsmedia-traitement-video
  extraProperties: {sonar.java.target=18, sonar.java.source=18}
  moduleKey: Module: 'wsmedia-traitement-video'
  excludedRules: [php:S1192]
  includedRules: []
  ruleParameters: {}
  inputFiles: [
    file:////wsl$/Ubuntu/home/mabid/Projets/wsmedia-traitement-video/src/processors/StreamProcessor.ts (UTF-8)
  ]
]

Start analysis
Index files
Language of file 'file:////wsl$/Ubuntu/home/mabid/Projets/wsmedia-traitement-video/src/processors/StreamProcessor.ts' is detected to be 'TypeScript'
1 file indexed
'JavaSensor' skipped because there is no related files in the current project
'JavaScript analysis' skipped because there is no related files in the current project
Execute Sensor: TypeScript analysis
eslint-bridge server is up, no need to start.
Failure during analysis, Node.js command to start eslint-bridge was: D:\Nodejs\node\node.exe C:\Users\mabid\AppData\Local\JetBrains\IntelliJIdea2022.2\tmp\sonarlint\.sonarlinttmp_17789480707406713336\eslint-bridge-bundle\package\bin\server 54831 127.0.0.1 D:\Projets\home_project true true 
java.io.UncheckedIOException: java.nio.file.FileSystemException: \\wsl$\Ubuntu\home\mabid\Projets\wsmedia-traitement-video\node_modules\@typescript-eslint\eslint-plugin\node_modules\.bin\semver: Fonction incorrecte
	at java.base/java.nio.file.FileTreeIterator.fetchNextIfNeeded(FileTreeIterator.java:87)
	at java.base/java.nio.file.FileTreeIterator.hasNext(FileTreeIterator.java:103)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:132)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at org.sonar.plugins.javascript.eslint.TsConfigProvider$LookupTsConfigProvider.tsconfigs(TsConfigProvider.java:126)
	at org.sonar.plugins.javascript.eslint.TsConfigProvider.tsconfigs(TsConfigProvider.java:88)
	at org.sonar.plugins.javascript.eslint.TypeScriptSensor.analyzeFiles(TypeScriptSensor.java:93)
	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:67)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:75)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.execute(SensorsExecutor.java:66)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:122)
	at org.sonarsource.sonarlint.core.plugin.commons.container.SpringComponentContainer.startComponents(SpringComponentContainer.java:182)
	at org.sonarsource.sonarlint.core.plugin.commons.container.SpringComponentContainer.execute(SpringComponentContainer.java:161)
	at org.sonarsource.sonarlint.core.analysis.container.module.ModuleContainer.analyze(ModuleContainer.java:71)
	at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:58)
	at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:32)
	at org.sonarsource.sonarlint.core.analysis.AnalysisEngine$AsyncCommand.execute(AnalysisEngine.java:153)
	at org.sonarsource.sonarlint.core.analysis.AnalysisEngine.executeQueuedCommands(AnalysisEngine.java:71)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.nio.file.FileSystemException: \\wsl$\Ubuntu\home\mabid\Projets\wsmedia-traitement-video\node_modules\@typescript-eslint\eslint-plugin\node_modules\.bin\semver: Fonction incorrecte
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53)
	at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:199)
	at java.base/java.nio.file.Files.readAttributes(Files.java:1851)
	at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:220)
	at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:277)
	at java.base/java.nio.file.FileTreeWalker.next(FileTreeWalker.java:374)
	at java.base/java.nio.file.FileTreeIterator.fetchNextIfNeeded(FileTreeIterator.java:83)
	... 23 more

'PHP sensor' skipped because there is no related files in the current project
'Analyzer for "php.ini" files' skipped because there is no related files in the current project
'Kotlin Sensor' skipped because there is no related files in the current project
'Python Sensor' skipped because there is no related files in the current project
Execute Sensor: HTML
Execute Sensor: Sonar Secrets Detection Sensor
'XML Sensor' skipped because there is no related files in the current project
'Ruby Sensor' skipped because there is no related files in the current project
Done in 83ms

Processed 0 issues
Found 0 issues

Hi,

Welcome to the community!

What’s your version of SonarLInt?

 
Thx,
Ann

Hi,

I use SonarLint 7.0.0.52289

Thx

1 Like

Hello.

I have same issue and same scenario, but with PHPStorm.
All issues reported are for PHP files/HTML. not for JS, which are indeed reported in our SonarCloud paid account.

I was connected and disconnected too to our account. Cleared caches/local storage storage and re-scanned whole project several times.
I usually use Node from WSL but also installed it locally and ensured path to binary is correct.

I’m not currently getting errors but no results at all.

Specs:
Windows 11
Ubuntu 20.04 on WSL2
Sonarlint 7.0.0.52289
Project running in Docker containers, accessible through \$WSL.…
PHPStorm (latest)
NodeJS 16 LTS, both on remote (Ubuntu) and in local (Windows)

image

image

Let me know if there’s anything else I can provide you.
Thanks

1 Like

Hi.
Any update or progress on this @ ganncamp? Not sure if it’s on your side.

Hi @fernando2amigos,

I’ve pinged the experts; it’s not on my side.

 
Ann

Great, thank you!
Looking forward to hear from them :slight_smile:

Sorry for coming late to this. There seems to be an issue when trying to browse the WSL filesystem from Java.

I found this bug report on the JDK side, with no resolution or workaround, unfortunately:
https://bugs.openjdk.org/browse/JDK-8259617

In the bug report, they mention the issue happens when your change file permissions from Windows. Is it something you have done @fernando2amigos or @mabid
Could you try removing the offending file and see if this would unlock the situation?

Hi and thanks for joining @Julien_HENRY

The issue isn’t on a specific file but on the overall project.
Also, the project is not on a mounted drive but accessing WSL directly.

image

And, since PHPStorm runs JAVA I don’t think it might be related to that.

image

Please note that PHP/HTML/CSS analysis runs just fine. The issue is with JS.
I tried running Node on both sides: local host (Win) and Ubuntu (WSL image) to no avail.

Also, I’m running SonarQube in the same Ubuntu image and it is reporting the JS stuff.

image

Let me know if there’s anything else I can provide you for further investigation.

I am trying to setup a reproducer. I would need the following information:

  • where is nodejs installed in your case? Windows of WSL?
  • From where do you run npm install? Windows command line or WSL?
  • Can you double check what is the node path used by SonarLint in IDE settings? In my case, I have installed nodejs in Windows, so SonarLint is using this one:

Thanks

Don’t waste your time, I was able to reproduce.

1 Like

Don’t waste your time, I was able to reproduce.

Hahaha, I was just about to answer you! :smiley:

Glad you were able to reproduce it.

Just in case:

  • where is nodejs installed in your case? Windows of WSL?

Both, currently using Windows one.

  • From where do you run npm install? Windows command line or WSL?

Inside Docker container where JS files are.

  • Can you double check what is the node path used by SonarLint in IDE settings? In my case, I have installed nodejs in Windows, so SonarLint is using this one:

Yep, same here: C:\Program Files\nodejs\node.exe (16.17.0)

OK, so it is not clear if it is a bug in WSL or in the JDK that prevent listing files. This is causing an issue when we try to browse the project to find the tsconfig file.

As a workaround, you can manually edit SonarLint project settings and configure the path to the tsconfig file:

I will see if there is something we can do on our side, but not too sure. Even IntelliJ is affected. :frowning:

FYI, a workaround has been implemented in our JS analyzer to avoid using the problematic API: