Skip to content

Instantly share code, notes, and snippets.

@carhartl
Last active August 29, 2015 14:18
Show Gist options
  • Save carhartl/254f6ffa42b5e19d80bb to your computer and use it in GitHub Desktop.
Save carhartl/254f6ffa42b5e19d80bb to your computer and use it in GitHub Desktop.
rubocop-emoji.rb
# rubocop app.rb --require "./emoji_formatter" --format EmojiFormatter
require "rubocop"
# This formatter display green hearts for files with no offenses and
# letters for files with problems in the them. In the end it
# appends the regular report data in the clang style format.
class EmojiFormatter < RuboCop::Formatter::ProgressFormatter
def report_file_as_mark(offenses)
mark = if offenses.empty?
"\u{1f49a}"
else
highest_offense = offenses.max_by(&:severity)
colored_severity_code(highest_offense)
end
output.write mark
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment