Skip to content

Instantly share code, notes, and snippets.

@gideao
Last active February 12, 2018 13:10
Show Gist options
  • Save gideao/1e46b62c17d2ad10549026c046bb3610 to your computer and use it in GitHub Desktop.
Save gideao/1e46b62c17d2ad10549026c046bb3610 to your computer and use it in GitHub Desktop.
Auto format and correcting Ruby code using rubocop or rufo
# Install entr and silversearcher-ag
sudo aptitude install entr silversearcher-ag
# Install rubocop and add "gem 'rubocop'" to Gemfile
gem install rubocop
# Add rubocop to Gemfile
echo "gem 'rubocop', require: false" >> Gemfile
# Watch for changes
ag --ruby -l | entr -c bundle exec rubocop -a
# Install entr and silversearcher-ag
sudo aptitude install entr silversearcher-ag
# Install rufo
gem install rufo
# Add rufo to Gemfile
echo "gem 'rufo'" >> Gemfile
# Waiting for changes in all files
ag -l | entr bundle exec rufo .
# or just ruby files
ag --ruby -l | entr -c bundle exec rufo lib spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment