Rubocop Autocorrect not Working on Ruby Container
Hi,
I can't get Rubocops auto-correct setting to work on my project. I am running the latest version of Rubymine: RubyMine 2023.2.6, Build #RM-232.10300.41, built on February 14, 2024.
Env setup:
- MacOS: 14.2.1 (23C71)
- SDK:
- Ruby version on Container: ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [aarch64-linux]
- Ruby version in .ruby-version: 3.0.6
- Ruby version locally installed in Project: ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [arm64-darwin22]
- Rubocop local: 1.54.2
- Rubucop on Docker container app dir: 1.48.1
Already checked this guide: https://www.jetbrains.com/help/ruby/rubocop.html#run_on_save
Checked this issue here: https://youtrack.jetbrains.com/issue/RUBY-26320/Rubymine-2020.1-docker-docker-compose-issues-MAC
Docker settings for running container:
Two things may happen:
- An error will show up saying there was an error with Rubocop
- The Autocorrect may work unexpectedly at certain moments, espcially when I hit save shortly after making a change to the code
This has been an ongoing issue for the last 2 years. Have you solved this issue already or point me in the right direction to address it.
Thank you!
请先登录再写评论。
Hello,
At the moment, there's another known issue with RuboCop and Docker, could you please take a look at it:
https://youtrack.jetbrains.com/issue/RUBY-30375/Docker-container-with-rubocop-infinite-execution
It's also worth checking on the latest RubyMine's version, which is 2024.1.2 if we speak about the stable versions (vs 2024.2 EAP)
Yes, I checked that issue, and it’s related to my problem.
I am wondering if it has something to do with my settings. In the new RM version the rubicon autocorrect seems to be triggered every time I change my code and hit save immediately after , just before Rubocop inspection highlights the error. Standard inspection seems to work properly though
The issue I mentioned is still in progress, so if you have something similar, could you please add your vote there and follow it.
I don’t find where to vote for this issue in the youtracker page.
RubyMine 2024.1
Build #RM-241.14494.234, built on March 27, 2024
Licensed to …
Subscription is active until July 18, 2024.
Runtime version: 17.0.10+8-b1207.12 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Metal Rendering is ON
Registry:
debugger.watches.in.variables=false
debugger.new.tool.window.layout=true
ide.experimental.ui=true
Hi everyone!
I'm facing a related problem. Everytime I run the rubocop integration, I get this error:
“Cannot find 'rubocop' in the installed gems.”
It indexes the gem after running “bundle install”:
/usr/local/bin/docker-compose -f /Users/username/workspace/project/docker-compose.yml -f /Users/username/Library/Caches/JetBrains/RubyMine2024.1/tmp/docker_compose/docker-compose.override.507.yml run --rm -T web
[+] Creating 2/0
✔ Container toguro-redis-1 Running0.0s
✔ Container toguro-db-1 Running0.0s
Fetching gem metadata from
https://rubygems.org/.....…
After indexing, it can't find the gem to run commands.
I'm using SDK as Remote Ruby Interpreter:
Arturo, you need to use Thumbs up button for that.
Rafael, is ‘rubocop’ gem listed for the interpreter in question in Settings | Languages & Frameworks | Ruby SDK and Gems?
Olga, yes, it is:
Rafael, I've tried to reproduce it in RubyMine 2024.1.3 with our sample app, but it worked fine. Could you please check it on the same version with our project?
Rafael. Try this:
See if that solves it
Thank you Olga and Arturo for your reply.
I cloned that sample project and reproduce these steps and it worked!
I returned to my project and it runs as well 👍🏾
Great to know that, Rafael, thanks for the update.