use self.options.diff directly

This commit is contained in:
Anthony Sottile 2021-11-25 15:54:33 -05:00
parent b857d25c81
commit a679ab4fb1

View file

@ -92,8 +92,6 @@ class Application:
#: with a non-zero status code #: with a non-zero status code
self.catastrophic_failure = False self.catastrophic_failure = False
#: Whether the program is processing a diff or not
self.running_against_diff = False
#: The parsed diff information #: The parsed diff information
self.parsed_diff: Dict[str, Set[int]] = {} self.parsed_diff: Dict[str, Set[int]] = {}
@ -186,8 +184,7 @@ class Application:
argv, argv,
) )
self.running_against_diff = self.options.diff if self.options.diff:
if self.running_against_diff:
LOG.warning( LOG.warning(
"the --diff option is deprecated and will be removed in a " "the --diff option is deprecated and will be removed in a "
"future version." "future version."
@ -241,7 +238,7 @@ class Application:
self.options, self.formatter self.options, self.formatter
) )
if self.running_against_diff: if self.options.diff:
self.guide.add_diff_ranges(self.parsed_diff) self.guide.add_diff_ranges(self.parsed_diff)
def make_file_checker_manager(self) -> None: def make_file_checker_manager(self) -> None:
@ -258,8 +255,9 @@ class Application:
:class:`~flake8.checker.Manger` instance run the checks it is :class:`~flake8.checker.Manger` instance run the checks it is
managing. managing.
""" """
assert self.options is not None
assert self.file_checker_manager is not None assert self.file_checker_manager is not None
if self.running_against_diff: if self.options.diff:
files: Optional[List[str]] = sorted(self.parsed_diff) files: Optional[List[str]] = sorted(self.parsed_diff)
if not files: if not files:
return return