Table of Contents
Static Code Analysis for your Ruby code
From the GitHub for Rubocop: (https://github.com/bbatsov/rubocop)
Setup Geany
- Open a Ruby file in Geany or simply create a new file and set the filetype to Ruby.
- Open the Set Build Commands dialog in the Build menu.
- Setup the custom command
- Set a label, e.g. “Check”
- Set the Command field to
/path/to/rvm/gems/ruby-version/wrappers/bundler exec rubocop %f
%f is a placeholder replaced by Geany on execution with the filename of the current file in the editor.
- Paste the following text in the “Error regular expression” field.
([^:]+):([0-9]+):([0-9:]+)? .*
This is used by Geany to parse the output of build commands for errors to be highlighted in the editor.
Usage in Geany
After setting up and saving Geany's build commands, you are ready to use this by simply pressing F9 or using the menu Build → Check to trigger the execution of the helper script and so let the tools check your code.
All errors and warnings reported by the tools are sent to the Compiler tab in the messages windows at the bottom of the Geany window. You can see the errors for review, click on them to jump to the corresponding code line and Geany will also mark the reported code lines directly in the editor with red squiggly underlines.
Ideally, you won't see much errors in your code :). Good luck.