Gem Version test

RuboCop runner for ERB template.

This is the ERB version of Slimcop.


Add this line to your application's Gemfile:

gem 'erbcop'

And then execute:

bundle install

Or install it yourself as:

gem install erbcop


Use erbcop executable to check offenses and auto-correct them.

$ erbcop --help
Usage: erbcop [options] [file1, file2, ...]
    -a, --auto-correct               Auto-correct offenses.
    -c, --config=                    Specify configuration file. (default: .erbcop.yml or .rubocop.yml)
        --[no-]color                 Force color output on or off.


$ erbcop 'spec/fixtures/**/*.erb'
Inspecting 1 file


spec/fixtures/dummy.erb:1:4: C: [Correctable] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
<% "a" %>
spec/fixtures/dummy.erb:4:9: C: [Correctable] Style/NumericPredicate: Use array.size.positive? instead of array.size > 0.
<% a if array.size > 0 %>
spec/fixtures/dummy.erb:4:9: C: [Correctable] Style/ZeroLengthPredicate: Use !empty? instead of size > 0.
<% a if array.size > 0 %>
spec/fixtures/dummy.erb:5:4: C: [Correctable] Style/NegatedIf: Favor unless over if for negative conditions.
<% a if !b %>

1 file inspected, 4 offenses detected, 4 offenses auto-correctable