Add support for stdout in the fix_file rule
At least `pep8` and `py.test` consider errors as normal and print them on stdout.
This commit is contained in:
@@ -25,7 +25,7 @@ patterns = (
|
||||
'^{file}: line {line}: ',
|
||||
# ghc, make, ruby, zsh:
|
||||
'^{file}:{line}:',
|
||||
# cargo, clang, gcc, go, rustc:
|
||||
# cargo, clang, gcc, go, pep8, rustc:
|
||||
'^{file}:{line}:{col}',
|
||||
# perl:
|
||||
'at {file} line {line}',
|
||||
@@ -45,7 +45,7 @@ patterns = [_make_pattern(p) for p in patterns]
|
||||
def _search(stderr):
|
||||
for pattern in patterns:
|
||||
m = re.search(pattern, stderr)
|
||||
if m:
|
||||
if m and os.path.isfile(m.group('file')):
|
||||
return m
|
||||
|
||||
|
||||
@@ -53,15 +53,15 @@ def match(command, settings):
|
||||
if 'EDITOR' not in os.environ:
|
||||
return False
|
||||
|
||||
m = _search(command.stderr)
|
||||
|
||||
return m and os.path.isfile(m.group('file'))
|
||||
return _search(command.stderr) or _search(command.stdout)
|
||||
|
||||
|
||||
def get_new_command(command, settings):
|
||||
m = _search(command.stderr)
|
||||
m = _search(command.stderr) or _search(command.stdout)
|
||||
|
||||
# Note: there does not seem to be a standard for columns, so they are just
|
||||
# ignored for now
|
||||
return shells.and_('{} {} +{}'.format(os.environ['EDITOR'], m.group('file'), m.group('line')),
|
||||
command.script)
|
||||
editor_call = '{} {} +{}'.format(os.environ['EDITOR'],
|
||||
m.group('file'),
|
||||
m.group('line'))
|
||||
return shells.and_(editor_call, command.script)
|
||||
|
||||
Reference in New Issue
Block a user