Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- changed_files = `git diff-tree --no-commit-id --name-only --diff-filter=AM -r HEAD`.lines.map(&:chomp)
- return if changed_files.empty?
- results = `bundle exec rubocop --color #{changed_files.join(" ")}`
- no_offenses_detected = results.include?("\e[32mno offenses\e[0m detected")
- return if no_offenses_detected
- results.each_line { |line| puts line }
- puts
- puts "\e[31m -- WARNING: cannot push to remote repos due to lingering style violations! -- \e[0m"
- puts
- exit! 1
Add Comment
Please, Sign In to add comment