sleroy / SonarEsLintPlugin

SonarQube plugin for EsLint linter
MIT License
87 stars 28 forks source link

java.lang.NullPointerException #2

Closed deuvarneys closed 6 years ago

deuvarneys commented 6 years ago

When running a scan with following your instructions from the README.md and the versions below, I get the following output. Is there a way that I can resolve this or am I running the tests incorrectly?

SonarQube: 6.7.2
ESLint: 4.5.0
Java: 1.8
ESLint Plugin: 0.2.0
21:57:01.595 INFO: Sensor Linting sensor for Javascript files [eslintplugin]
21:57:01.595 DEBUG: Found sonar.eslint.eslintpath Lint path to be 'node_modules/eslint/bin/eslint.js'
21:57:01.595 DEBUG: #1 Trying to resolve path in node_modules/eslint/bin/eslint.js
21:57:01.596 DEBUG: #2 Trying to resolve path in /Users/dsanderson/Projects/src/react/node_modules/eslint/bin/eslint.js
21:57:01.596 DEBUG: EsLint Absolute path is Optional[/Users/dsanderson/Projects/src/react/node_modules/eslint/bin/eslint.js]
21:57:01.597 DEBUG: Found sonar.eslint.eslintconfigpath Lint path to be './eslint.json'
21:57:01.597 DEBUG: #1 Trying to resolve path in ./eslint.json
21:57:01.597 DEBUG: #2 Trying to resolve path in /Users/dsanderson/Projects/src/react/./eslint.json
21:57:01.597 DEBUG: EsLint Absolute path is Optional[/Users/dsanderson/Projects/src/react/./eslint.json]
21:57:01.597 DEBUG: #1 Trying to resolve path in .eslintrc
21:57:01.597 DEBUG: #2 Trying to resolve path in /Users/dsanderson/Projects/src/react/.eslintrc
21:57:01.597 DEBUG: #1 Trying to resolve path in .eslintrc.js
21:57:01.598 DEBUG: #2 Trying to resolve path in /Users/dsanderson/Projects/src/react/.eslintrc.js
21:57:01.598 DEBUG: #1 Trying to resolve path in .eslintrc.json
21:57:01.598 DEBUG: #2 Trying to resolve path in /Users/dsanderson/Projects/src/react/.eslintrc.json
21:57:01.598 DEBUG: #1 Trying to resolve path in .eslintrc.yaml
21:57:01.598 DEBUG: #2 Trying to resolve path in /Users/dsanderson/Projects/src/react/.eslintrc.yaml
21:57:01.598 DEBUG: #1 Trying to resolve path in .eslintrc.yml
21:57:01.598 DEBUG: #2 Trying to resolve path in /Users/dsanderson/Projects/src/react/.eslintrc.yml
21:57:01.599 DEBUG: Path sonar.eslint.eslintrulesdir not specified
21:57:01.599 DEBUG: Path sonar.eslint.eslintrulesdir not specified, falling back to null
21:57:01.606 DEBUG: Using a temporary path for EsLint output: /Users/dsanderson/Projects/src/react/.scannerwork/.sonartmp/3122295272195353071.tmp
21:57:01.607 DEBUG: Split 728 files into  27 batches for processing
21:57:01.607 DEBUG: Executing EsLint with command: node....

....
....
....

21:39:57.464 INFO: ------------------------------------------------------------------------
21:39:57.464 INFO: EXECUTION FAILURE
21:39:57.464 INFO: ------------------------------------------------------------------------
21:39:57.464 INFO: Total time: 1:54.946s
21:39:57.560 INFO: Final Memory: 36M/1536M
21:39:57.561 INFO: ------------------------------------------------------------------------
21:39:57.561 ERROR: Error during SonarQube Scanner execution
java.lang.NullPointerException
    at io.github.sleroy.sonar.EsLintSensor.execute(EsLintSensor.java:121)
    at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
    at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
    at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:288)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:283)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:261)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
    at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
    at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
sleroy commented 6 years ago

Thank you for the report. I will investigate it, this week end and will attempt to fix it.

deuvarneys commented 6 years ago

Great to hear! Thanks for the quick response. Please let me know if you need any more details.

sleroy commented 6 years ago

@deuvarneys could you provide me a small JS project to test on it ?

sleroy commented 6 years ago

The plugin has crashed because one of your ESLint Issue didn't have attached ruleID

sleroy commented 6 years ago

Fixed the bug : 22:07:07.862 INFO: SonarQube Scanner 3.1.0.1141 22:07:07.862 INFO: Java 1.8.0_121 Oracle Corporation (64-bit) 22:07:07.862 INFO: Linux 4.13.0-36-generic amd64 22:07:08.316 INFO: SonarQube server 6.7.2

22:07:09.446 DEBUG: * ESLint 0.3.0 (eslintplugin)

The plugin was performing a NPE if the JS analyzed file has a parsing error or is ignored by ESLint .

sleroy commented 6 years ago

Could you test the latest version and notify me if the fix is working for you ?

sSeewald commented 6 years ago

I had the same issue. For me everything works fine after the fix. Works with v7:latest. thx @sleroy

deuvarneys commented 6 years ago

@sleroy I will make sure to test this change by tomorrow latest. Thank you for the quick response.

deuvarneys commented 6 years ago

Everything appears to be working well. Thank you very much for the quick fix!

codingmkd commented 6 years ago

Is this bug fixed or still is it open

sleroy commented 6 years ago

I will close this issue since the reporter doesn't have the bug anymore.

codingmkd commented 6 years ago

But i had the same issue yesterday

codingmkd commented 6 years ago

Please post the bersion after this issue was fixed

codingmkd commented 6 years ago

After the issue is fixed what is the version you updated or if you can help me with the fix needed to fix the bug, that would be great

sleroy commented 6 years ago

@codingmkd I will fix the release 0.3.0 and reupload the JAR. Then please test with this new version. If you still have the problem, open a new fix. As I said, the reporter does not have the issue anymore. Probably the plugin has another issue, I will fix it.

imVinayPandya commented 5 years ago

i am getting same error

java.lang.NullPointerException at io.github.sleroy.sonar.EsLintSensor.execute(EsLintSensor.java:116) at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53) at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88) at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82) at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68) at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88) at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121) at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:302) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:297) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:271) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121) at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48) at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121) at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121) at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116) at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) at com.sun.proxy.$Proxy0.execute(Unknown Source) at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171) at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128) at org.sonarsource.scanner.cli.Main.execute(Main.java:111) at org.sonarsource.scanner.cli.Main.execute(Main.java:75) at org.sonarsource.scanner.cli.Main.main(Main.java:61)