Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have tried two different tools: rubocop and Cane. In a test I found that rubocop gives almost twice as many warnings as cane (and rubocop reports everything that Cane reports). So, I recommend rubocop.</p> <h1>rubocop</h1> <p><a href="https://github.com/bbatsov/rubocop" rel="nofollow noreferrer">rubocop</a> is a </p> <blockquote> <p>Ruby code style checker based on the <a href="https://github.com/bbatsov/ruby-style-guide" rel="nofollow noreferrer">Ruby Style Guide</a>.</p> </blockquote> <h2>Installation</h2> <p>You can install it as a gem:</p> <pre><code>gem install rubocop </code></pre> <p>(The above might need to prefixed the command with <code>sudo</code> depending on your setup.)</p> <h2>Usage</h2> <p>rubocop is used by running the command with the same name from the command line. If you provide files as arguments rubocop checks those files. If you provide directories as arguments rubocop check Ruby files in the directories recursively, i.e. in the given directories and all their subdirectories. If you provide no argument it check the working directory recursively.</p> <p>Here is an example. Given the following file</p> <pre class="lang-ruby prettyprint-override"><code>say="I am not in style" puts(say) ['cow','cat','cake'].each{|i| print i+' '} </code></pre> <p>robucop reports as follows:</p> <pre> $ rubocop ~/test/rubocop.rb == /home/nn/test/rubocop.rb == C: 1: Missing encoding comment. C: 1: Surrounding space missing for operator '='. C: 4: Surrounding space missing for operator '+'. C: 4: Surrounding space missing for '{'. C: 4: Space missing to the left of '}'. C: 4: Space missing after comma. C: 4: Space missing after comma. C: 1: Prefer single-quoted strings when you don't need string interpolation or special symbols. 1 files inspected, 8 offences detected </pre> <p>Note that rubocop can output warnings that Emacs can parse via the <code>-e</code> option.</p> <h1>Cane</h1> <p>Cane is a tool to check code style. It can be <a href="https://github.com/square/cane#integrating-with-rake" rel="nofollow noreferrer">integrated with Rake</a>.</p> <h2>Installation</h2> <p>You can install it as a gem:</p> <pre><code>gem install cane </code></pre> <p>(The above might need to prefixed the command with <code>sudo</code> depending on your setup.)</p> <h2>Usage</h2> <p>To use it run <code>cane</code> on the directories or files you want to check.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload