Merge pull request #1540 from asottile/unused-param

remove unused parameter from make_formatter
This commit is contained in:
Anthony Sottile 2022-01-23 19:38:47 -05:00 committed by GitHub
commit 69eb576dd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 7 deletions

View file

@ -158,8 +158,7 @@ class StyleGuide:
"Report should be subclass of " "Report should be subclass of "
"flake8.formatter.BaseFormatter." "flake8.formatter.BaseFormatter."
) )
self._application.formatter = None self._application.formatter = reporter(self.options)
self._application.make_formatter(reporter)
self._application.guide = None self._application.guide = None
# NOTE(sigmavirus24): This isn't the intended use of # NOTE(sigmavirus24): This isn't the intended use of
# Application#make_guide but it works pretty well. # Application#make_guide but it works pretty well.

View file

@ -10,7 +10,6 @@ from typing import Optional
from typing import Sequence from typing import Sequence
from typing import Set from typing import Set
from typing import Tuple from typing import Tuple
from typing import Type
import flake8 import flake8
from flake8 import checker from flake8 import checker
@ -183,9 +182,7 @@ class Application:
except TypeError: except TypeError:
parse_options(self.options) parse_options(self.options)
def make_formatter( def make_formatter(self) -> None:
self, formatter_class: Optional[Type[BaseFormatter]] = None
) -> None:
"""Initialize a formatter based on the parsed options.""" """Initialize a formatter based on the parsed options."""
assert self.plugins is not None assert self.plugins is not None
assert self.options is not None assert self.options is not None

View file

@ -122,7 +122,7 @@ def test_styleguide_init_report():
raise NotImplementedError raise NotImplementedError
style_guide.init_report(FakeFormatter) style_guide.init_report(FakeFormatter)
app.make_formatter.assert_called_once_with(FakeFormatter) assert isinstance(app.formatter, FakeFormatter)
assert app.guide is None assert app.guide is None
app.make_guide.assert_called_once_with() app.make_guide.assert_called_once_with()