class Overcommit::Hook::PreCommit::Pycodestyle
Runs `pycodestyle` against any modified Python files.
Public Instance Methods
run()
click to toggle source
# File lib/overcommit/hook/pre_commit/pycodestyle.rb, line 8 def run result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? && output.empty? # example message: # path/to/file.py:88:5: E301 expected 1 blank line, found 0 extract_messages( output.split("\n"), /^(?<file>(?:\w:)?[^:]+):(?<line>\d+):\d+:\s(?<type>E|W)/, lambda { |type| type.include?('W') ? :warning : :error } ) end