Differences

This shows you the differences between two versions of the page.

Link to this comparison view

howtos:rubocop [2017/10/25 21:57] (current)
mbidwell created
Line 1: Line 1:
 +===== 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 <​code>​
 +/​path/​to/​rvm/​gems/​ruby-version/​wrappers/​bundler exec rubocop %f
 +</​code>​ %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. <​code>​
 +([^:​]+):​([0-9]+):​([0-9:​]+)?​ .*
 +</​code>​ 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.
 +
 +{{tag>​howto rubocop ruby rails}}
Print/export