Replies: 1 comment 1 reply
-
The documentation suggests that you can create your own formatters by subclassing So you can do these steps. Create file class MyFormatter < RuboCop::Formatter::BaseFormatter
def file_finished(file, offenses)
return if offenses.empty?
offenses.each do |offense|
output.puts("#{offense.message}\n in #{file}")
end
end
end And now you can use it as formatter And the output will have such style:
You can add colors and other information for your purposes in your formatter class. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
To me, the default output of rubocop always seems messy.
I always find myself creating the todo file so I can better understand the output.
So I wonder if there is openness to consider slight adjustments, and if not, I wonder how difficult it would be for me to create a custom formatter that is always used.
I took the liberty to do a rough mock.
Standard rubocop output
(also keep in mind, when the terminal is narrower, word wrapping makes it even less readable)
Modified output
First, the cop, then the message, then the location.
Beta Was this translation helpful? Give feedback.
All reactions