RuboCop linting for ERB templates.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Use default configuration file .ruumba.yml. Nov 3, 2018
lib
scripts/git_hooks
spec
.gitignore
.rubocop.yml Make sure tmpdir created by ruumba is removed Dec 17, 2018
.ruby-version Revert ruby-version to 2.3 series Oct 11, 2018
.travis.yml Run tests on travis for more Rubies. Oct 31, 2018
Gemfile
Gemfile.lock Bump to version 0.1.9 Jan 10, 2019
Guardfile Open source Apr 26, 2015
LICENSE Open source Apr 26, 2015
README.md Revert ruby-version to 2.3 series Oct 11, 2018
Rakefile
VERSION Bump to version 0.1.9 Jan 10, 2019
ruumba.gemspec Bump version Nov 9, 2018

README.md

Ruumba

Build Status

.erb or .rb, you're coming with me.

— RuboCop

About

Ruumba is RuboCop's sidekick, allowing you to lint your .erb Rubies as well as your regular-type ones.

Dependencies

  • Ruby 2.3+

Installation

λ gem install ruumba

Usage

Command line:

λ ruumba directory_of_erb_files/

Rake task:

require 'ruumba/rake_task'

Ruumba::RakeTask.new(:ruumba) do |t|
  t.dir = %w(lib/views)

  # You can specify CLI options too:
  t.options = { arguments: %w[-c .ruumba.yml] }
end

Then:

λ bundle exec rake ruumba

Fix paths and unapplicable cops

By default, Rubocop only scan .rb files and so does Ruumba. If you want shown paths to reflect original paths, you can add create a .ruumba.yml config file with the following contents:

AllCops:
  Include:
    - '**/*.erb'

You can then disable .rb extension auto-append and use your config file:

λ ruumba -D -e app/views -c .ruumba.yml

Since Ruumba rewrites new files form .erb files contents, some formatting cops cannot apply, you can disable them in your Ruumba file:

Style/FrozenStringLiteralComment:
  Enabled: false
Layout/AlignHash:
  Enabled: false
Layout/AlignParameters:
  Enabled: false
Layout/IndentationWidth:
  Enabled: false
Layout/TrailingBlankLines:
  Enabled: false

You can use ruumba -a or ruumba -D to look for other cops if this list is missing some.

You might want to include your existing rubocop config file by appending this in front of your Ruumba config:

inherit_from: .rubocop.yml

Contributing

  1. Branch (git checkout -b fancy-new-feature)
  2. Commit (git commit -m "Fanciness!")
  3. Test (bundle exec rake spec)
  4. Lint (bundle exec rake rubocop)
  5. Push (git push origin fancy-new-feature)
  6. Ye Olde Pulle Requeste