class Overcommit::Hook::PreCommit::PythonFlake8
Runs ‘flake8` against any modified Python files.
Constants
- MESSAGE_REGEX
- MESSAGE_TYPE_CATEGORIZER
Classify ‘Exxx’ and ‘Fxxx’ message codes as errors, everything else as warnings.
http://flake8.readthedocs.org/en/latest/warnings.html
Public Instance Methods
run()
click to toggle source
# File lib/overcommit/hook/pre_commit/python_flake8.rb, line 17 def run result = execute(command, args: applicable_files) return :pass if result.success? output = result.stdout.chomp # example message: # path/to/file.py:2:13: F812 list comprehension redefines name from line 1 extract_messages( output.split("\n").grep(MESSAGE_REGEX), MESSAGE_REGEX, MESSAGE_TYPE_CATEGORIZER ) end