Created
September 25, 2018 16:03
-
-
Save monkseal/d5cb4a8a28ecf4b4b4b1919af896040e to your computer and use it in GitHub Desktop.
Rubocop change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc 'Run RuboCop on the app and lib directories based on git diff' | |
Rubocop::RakeTask.new('rubocop') do |task| | |
cmd = 'git diff --name-only --diff-filter=ACMRTUXB ' \ | |
'$(git merge-base HEAD flux) ' \ | |
'| egrep \'\.rake$|\.rb$\'' | |
diff = `#{cmd}` | |
# always include this file, if the patterns is empty it run everything | |
patterns = ['lib/tasks/ci.rake'] | |
patterns += diff.split("\n") | |
task.patterns = patterns.reject do |pattern| | |
RUBOCOP_IGNORE.any? { |ignore_exp| ignore_exp.match(pattern) } | |
end | |
task.fail_on_error = true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment