mrcljx / rubocop-for-rubymine

DEPRECATED: RubyMine supports RuboCop now
https://blog.jetbrains.com/ruby/2017/01/rubymine-2017-1-eap-2-creating-gemsets-rubocop-support/
MIT License
131 stars 29 forks source link

ProcessNotCreatedException: Failed to run RuboCop command on RubyMine 8.0.3 and plugin 3.1.0 #34

Open ikappas opened 8 years ago

ikappas commented 8 years ago

This is the similar/related issue with #30.

After re-inspecting the idea.log file I can see that rubocop is executed with the following command:

rubocop --format json [path to project]/test.rb

the test.rb path is the absolute path to the project file (Verified to be OK)

This command produces the correct output when run under terminal

path/to/project/root $ rubocop --format json [path to project]/test.rb

{"metadata":{"rubocop_version":"0.35.1","ruby_engine":"ruby","ruby_version":"2.1.7","ruby_patchlevel":"400","ruby_platform":"x86_64-darwin15.0"},"files":[{"path":"test.rb","offenses":[]}],"summary":{"offense_count":0,"target_file_count":1,"inspected_file_count":1}}

@sirlantis As you mentioned this should be bundler exec

@sirlantis I have modified this after the restart you suggested

mrcljx commented 8 years ago

Can you restart ruby mine to confirm that 3.1.0 is loaded properly? That bug should definitely not appear since I'm not adding "exec" anywhere anymore since 3.1.0

ikappas commented 8 years ago

@sirlantis I have restarted the mac and the issue still persists. Thank you for looking into this

ikappas commented 8 years ago

Btw, I switched to another rubygem project and I am getting the following IDE Fatal Error:

ProcessNotCreatedException: Failed to run RuboCop command - is it installed? (SDK=/Users/[username]/.rbenv/versions/2.1.6/bin): Cannot run program "rubocop" (in directory "/Users/[username]/[project path]"): error=2, No such file or directory
ikappas commented 8 years ago

Opening the Gemfile ( or any other .rb ) produces the following in the idea.log:

2015-12-28 12:40:42,806 [ 326885]   INFO - .ruby.ruby.run.RubyCommandLine - Executing [rubocop --format json /Users/[username]/Documents/Development/Community/Ruby/php-composer-semver/Gemfile], working dir =[/Users/[username]/Documents/Development/Community/Ruby/php-composer-semver] 
java.io.IOException: Cannot run program "rubocop" (in directory "/Users/[username]/Documents/Development/Community/Ruby/php-composer-semver"): error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:368)
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:354)
    at org.jetbrains.plugins.ruby.ruby.run.RubyCommandLine.createProcess(RubyCommandLine.java:64)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask$runViaCommandLine$1.invoke(RubocopTask.kt:173)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask$runViaCommandLine$1.invoke(RubocopTask.kt:25)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.parseProcessOutput(RubocopTask.kt:67)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.runViaCommandLine(RubocopTask.kt:173)
    at io.github.sirlantis.rubymine.rubocop.RubocopTask.run(RubocopTask.kt:60)
    at io.github.sirlantis.rubymine.rubocop.RubocopAnnotator.doAnnotate(RubocopAnnotator.kt:157)
    at io.github.sirlantis.rubymine.rubocop.RubocopAnnotator.doAnnotate(RubocopAnnotator.kt:24)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.a(ExternalToolPass.java:218)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$500(ExternalToolPass.java:44)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:160)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
    at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:298)
    at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:295)
    at com.intellij.util.concurrency.QueueProcessor$2$1.run(QueueProcessor.java:110)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.concurrency.QueueProcessor$2.consume(QueueProcessor.java:107)
    at com.intellij.util.concurrency.QueueProcessor$2.consume(QueueProcessor.java:104)
    at com.intellij.util.concurrency.QueueProcessor$3$1.run(QueueProcessor.java:215)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.concurrency.QueueProcessor$3.run(QueueProcessor.java:212)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:365)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:55)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 39 more
ikappas commented 8 years ago

Wow... this is two issues related to the command being executed.

After switching back to the original project I get the original behaviour:

 Failed to parse RuboCop output: Please make sure that:you installed RuboCop for this Ruby versionyou did run bundle install successfully (if you use Bundler)your RuboCop version isn't ancient

When I switch to the other project I mentioned I get the following error:

 ProcessNotCreatedException: Failed to run RuboCop command - is it installed? ...

I can verify that the rubocop is installed and can be executed under terminal for both projects.

Perhaps this issue is project related?

akifateef commented 8 years ago

I am also getting this on the same project I mentioned in Issue #30.

4:38:46 PM ProcessNotCreatedException: Failed to run RuboCop command - is it installed? (SDK=/home/a/.rvm/rubies/jruby-1.7.13/bin): Cannot run program "rubocop" (in directory "/home/a/t/g"): error=2, No such file or directory
ikappas commented 8 years ago

@sirlantis Happy new year! Is there any update on this?

longh957 commented 8 years ago

:+1:

elskwid commented 8 years ago

@ikappas mind if I ask where you install your gems? I just spent a couple of days working with RM to get it to even see my gems and ended up with a strange solution. (I actually install my gems with bundler to a non-standard path bundle install --path .bundle and I do so without RVM or anything else. So, the default RM gem + bundler detection was failing.)

Here's what I did:

GEM_PATH="/path/to/.bundle/ruby/2.3.0:$GEM_PATH" bundle exec mine

yeah, starting RM inside the bundled environment... strange but it works.

beder commented 8 years ago

thanks @elskwid. bundle exec mine did the trick for me.

cbrwizard commented 8 years ago

Same for me, works only with bundle exec mine

masonnl commented 8 years ago

3.1.0 plugin and RM 8.0.3 started from the project directory with bundle exec mine did the trick for me too. Strange, but thank you!

gipnokote commented 8 years ago

Wow. I had "End of input at line 1 column 1" problem too (not the "Cannot run program "rubocop" problem). 8.0.3 / 3.1.0, Ubuntu. The exact command from the logs was showing that the rubocop was able to generate proper json.

I tried everything and nothing helped until I tried bundle exec mine. This finally got the plugin going!

danlaffan commented 8 years ago

Any update on fixing this?

CyberStrike commented 8 years ago

@danlaffan you can try my unofficial release on Pull-Request #39

danlaffan commented 8 years ago

Thank you! That worked for me on MacOS.

r00takaspin commented 8 years ago

@beder +1, thank you