olivernybroe / phpinsights-intellij

The IntelliJ integration of phpinsights
MIT License
18 stars 2 forks source link

[BUG] Cannot run PHP Insights with Windows #16

Open Lukasss93 opened 4 years ago

Lukasss93 commented 4 years ago

image

olivernybroe commented 4 years ago

Thanks for reporting this. This whole plugin is due for a rewrite when PhpStorm releases 2020.3 EAP, as they now have made an official API for building plugins like this.

With that rewrite and their new api, this should be supported.

I'll quickly look into if I can fix the rewrite.

olivernybroe commented 4 years ago

@Lukasss93 That error you are getting is simply as it says, it is failing to run php insights on your computer.

Could you try to run that bat file manually with --version as a parameter.

Lukasss93 commented 4 years ago

Launching vendor\bin\phpinsights.bat --version in terminal works fine: phpstorm64_i8NFtvq9d7

jthayne commented 3 years ago

Not sure what the status is on this, however, I am having the same issue in the two different projects I am working on. The projects have the following relative specs:

Project A:

Project B:

I get the same results as above. I did decide to run an Inspection in PhpStorm on the code just to see what happened, and got the following error:

Can not correctly run the tool with parameters: analyse C:/Users/<username>/AppData/Local/Temp/phpinsights_temp.tmp/<path_to_file>/<file_name> --format=json

From this, I assume that the files are being copied into a temp folder and then analyzed. However, the files do not appear to actually exist within the temp folder at any point leading me to believe that there is an issue creating the temp file. The files for phpcs are being created properly, however. Is this related to the API issue mentioned above?

olivernybroe commented 3 years ago

@jthayne To be honest, I haven't looked into this in a long time. Biggest reason is that I don't use Windows myself, so it's really hard to test it.

The tmp file should be the same the same approach the phpcs built in plug-in uses. So don't really get why that doesn't work on Windows.

Don't really have any solid information yet, so I know what we should do :( hopefully some Windows users can fix this.

jthayne commented 3 years ago

@olivernybroe Understood. I will see if I can find anything. Didn't want to duplicate efforts if anything was going on with it. I will report back if I am able to find anything.

Thank you for the quick response and for the work on this.

henrychen95 commented 3 years ago

phpStorm 2020.3 OS: Windows 10 Professional x64

IDE Fatal Errors

  1. stacktrace.txt

    java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
    at com.intellij.execution.process.ProcessWaitFor.waitFor(ProcessWaitFor.java:87)
    at com.intellij.execution.process.BaseOSProcessHandler.waitFor(BaseOSProcessHandler.java:200)
    at com.intellij.execution.process.OSProcessHandler.waitFor(OSProcessHandler.java:120)
    at com.phpinsights.phpinsights.ProcessCreator.lambda$runToolProcess$0(ProcessCreator.java:46)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: java.lang.NullPointerException
    at com.phpinsights.phpinsights.MessageProcessor.done(MessageProcessor.java:80)
    at com.phpinsights.phpinsights.OutputProcessor.notifyProcessTerminated(OutputProcessor.java:38)
    at com.phpinsights.phpinsights.ProcessHandler.notifyProcessTerminated(ProcessHandler.java:22)
    at com.intellij.execution.process.BaseProcessHandler.onOSProcessTerminated(BaseProcessHandler.java:61)
    at com.intellij.execution.process.OSProcessHandler.onOSProcessTerminated(OSProcessHandler.java:206)
    at com.intellij.execution.process.BaseOSProcessHandler$1.lambda$startNotified$0(BaseOSProcessHandler.java:97)
    at com.intellij.execution.process.ProcessWaitFor.lambda$new$0(ProcessWaitFor.java:55)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208)
    at com.intellij.execution.process.ProcessWaitFor.lambda$new$1(ProcessWaitFor.java:33)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    ... 1 more
  2. induced.txt

Following exceptions happened soon after this one, most probably they are induced.

2020-12-04T00:47:06.838
java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
    at com.intellij.execution.process.ProcessWaitFor.waitFor(ProcessWaitFor.java:87)
    at com.intellij.execution.process.BaseOSProcessHandler.waitFor(BaseOSProcessHandler.java:200)
    at com.intellij.execution.process.OSProcessHandler.waitFor(OSProcessHandler.java:120)
    at com.phpinsights.phpinsights.ProcessCreator.lambda$runToolProcess$0(ProcessCreator.java:46)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
    at com.phpinsights.phpinsights.MessageProcessor.done(MessageProcessor.java:80)
    at com.phpinsights.phpinsights.OutputProcessor.notifyProcessTerminated(OutputProcessor.java:38)
    at com.phpinsights.phpinsights.ProcessHandler.notifyProcessTerminated(ProcessHandler.java:22)
    at com.intellij.execution.process.BaseProcessHandler.onOSProcessTerminated(BaseProcessHandler.java:61)
    at com.intellij.execution.process.OSProcessHandler.onOSProcessTerminated(OSProcessHandler.java:206)
    at com.intellij.execution.process.BaseOSProcessHandler$1.lambda$startNotified$0(BaseOSProcessHandler.java:97)
    at com.intellij.execution.process.ProcessWaitFor.lambda$new$0(ProcessWaitFor.java:55)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208)
    at com.intellij.execution.process.ProcessWaitFor.lambda$new$1(ProcessWaitFor.java:33)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    ... 1 more