What is the way to debug Rails and Ruby code (i.e. breakpoints, call stack etc...) which is running inside a separate JVM using IDE (IntelliJ Idea)? What configuration is required for it in Sonarqube and IntelliJ?
I did not find this information on Sonarqube site or elsewhere.
Asked
Active
Viewed 648 times
5

Sergey
- 3,253
- 2
- 33
- 55
2 Answers
4
Have a look at http://docs.sonarqube.org/display/DEV/Extend+Web+Application. See section Applications -> Development mode.
Regards

Julien L. - SonarSource Team
- 2,577
- 17
- 15
-
There is a useful information there, but it does not say anything about debugging code using IDE (i.e. stopping on breakpoints etc...) – Sergey Jun 11 '15 at 14:18
-
I'm not aware of being able to set some break point in rails code. On my side, I'm using some good old : puts "### Blabla" to understand what happen... – Julien L. - SonarSource Team Jun 12 '15 at 07:27
-
There is such option. See for example https://www.jetbrains.com/ruby/features/ruby_debugger.html Using "puts" works too, but productivity will be completely different. – Sergey Jun 14 '15 at 07:17
-
You can put `binding.pry` at arbitrary point in code to pause execution and drop into pry console. This will work in the context of a Rails server as well. This is not an IDE way though and will require some setup. See [Pry Runtime invocation](https://github.com/pry/pry#runtime-invocation) for more. – Nic Nilov Jun 16 '15 at 12:07
1
Your best bet is to go with RubyMine: https://www.jetbrains.com/ruby/
It's a version of Intellij for Ruby and Rails. It's got excellent debugging tools. You can find more information about how to set breakpoints and so forth here: https://www.jetbrains.com/ruby/features/ruby_debugger.html
RubyMine is gaining popularity, but most ruby developers just drop a binding.pry
at the point in their code they want to debug. Pry
is an extremely popular gem that offers great debugging tools. Here's more info on how to use that particular feature: https://github.com/pry/pry#runtime-invocation

williamcodes
- 6,317
- 8
- 32
- 55