Skip to content

Commit

Permalink
Fixes an issue with isort output when pipes are uses
Browse files Browse the repository at this point in the history
  • Loading branch information
Martijn Jacobs committed Mar 16, 2019
1 parent bb4c723 commit e1b879e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions flake8_isort.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Flake8Isort(object):

config_file = None
show_traceback = False
stdin_display_name = None

def __init__(self, tree, filename, lines, search_current=True):
self.filename = filename
Expand Down Expand Up @@ -63,22 +64,26 @@ def parse_options(cls, options):
else:
cls.config_file = False

cls.stdin_display_name = options.stdin_display_name
cls.show_traceback = options.isort_show_traceback

def run(self):
settings_file = self.search_isort_config()
if self.config_file and not settings_file:
yield 0, 0, self.no_config_msg, type(self)
else:
if self.filename is not self.stdin_display_name:
file_path = self.filename
else:
file_path = None
with OutputCapture() as buffer:
sort_result = SortImports(
file_path=self.filename,
file_path=file_path,
file_contents=''.join(self.lines),
check=True,
settings_path=settings_file,
show_diff=True,
)

traceback = self._format_isort_output(buffer)

for line_num, message in self.sortimports_linenum_msg(sort_result):
Expand Down

0 comments on commit e1b879e

Please sign in to comment.