Last active
August 29, 2015 14:18
-
-
Save carhartl/254f6ffa42b5e19d80bb to your computer and use it in GitHub Desktop.
rubocop-emoji.rb
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
# 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