class Overcommit::Hook::PreCommit::RuboCop
Runs `rubocop` against any modified Ruby files.
@see batsov.com/rubocop/
Constants
- COP_MESSAGE_TYPE_CATEGORIZER
- GENERIC_MESSAGE_TYPE_CATEGORIZER
Public Instance Methods
run()
click to toggle source
# File lib/overcommit/hook/pre_commit/rubo_cop.rb, line 16 def run result = execute(command, args: applicable_files) return :pass if result.success? generic_messages = extract_messages( result.stderr.split("\n"), /^(?<type>[a-z]+)/i, GENERIC_MESSAGE_TYPE_CATEGORIZER, ) cop_messages = extract_messages( result.stdout.split("\n"), /^(?<file>(?:\w:)?[^:]+):(?<line>\d+):[^ ]+ (?<type>[^ ]+)/, COP_MESSAGE_TYPE_CATEGORIZER, ) generic_messages + cop_messages end