Skip to content

Commit

Permalink
feat: improve options handling
Browse files Browse the repository at this point in the history
  • Loading branch information
gforcada committed Oct 9, 2022
1 parent 9ced567 commit 860e7c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions flake8_isort.py
Expand Up @@ -24,19 +24,17 @@ def __init__(self, tree, filename, lines):
self.filename = filename
self.lines = lines

@classmethod
def add_options(cls, parser):
parser.add_option(
def add_options(option_manager):
option_manager.add_option(
'--isort-show-traceback',
action='store_true',
parse_from_config=True,
help='Show full traceback with diff from isort',
)

@classmethod
def parse_options(cls, options):
cls.stdin_display_name = options.stdin_display_name
cls.show_traceback = options.isort_show_traceback
def parse_options(self, option_manager, options, args):
self.stdin_display_name = options.stdin_display_name
self.show_traceback = options.isort_show_traceback


class Flake8Isort4(Flake8IsortBase):
Expand Down
2 changes: 1 addition & 1 deletion run_tests.py
Expand Up @@ -223,7 +223,7 @@ def test_isort_formatted_output(tmpdir):
diff = ' from __future__ import division\n+\n import os'

checker = Flake8Isort(None, file_path, lines)
checker.parse_options(options(None, True, 'stdin'))
checker.parse_options(None, options(None, True, 'stdin'), None)
ret = list(checker.run())
assert len(ret) == 1
assert ret[0][0] == 3
Expand Down

0 comments on commit 860e7c2

Please sign in to comment.