Skip to content

Instantly share code, notes, and snippets.

View thorstenspringhart's full-sized avatar
🎯
Focusing

Thorsten Springhart thorstenspringhart

🎯
Focusing
  • Endress+Hauser Digital Solutions
  • Freiburg / Germany
  • X @thollsten
View GitHub Profile
@thorstenspringhart
thorstenspringhart / clean_code.rake
Created January 26, 2018 21:47
extended rake tasks to run rubocop only on uncommitted files / diff with master or entire project
namespace :clean_code do
# rubcop only available in dev
if Rails.env.development?
require 'rubocop/rake_task'
def diff_files
cmd = %q( git diff --name-only --diff-filter=ACMRTUXB \
$(git merge-base HEAD origin/master) \
| egrep '\.rake$|\.rb$' )
diff = `#{cmd}`
diff.split("\n")