diff --git a/isort/core.py b/isort/core.py index 663dd669..37c8fc31 100644 --- a/isort/core.py +++ b/isort/core.py @@ -516,7 +516,7 @@ def _indented_config(config: Config, indent: str) -> Config: def _has_changed(before: str, after: str, line_separator: str, ignore_whitespace: bool) -> bool: if ignore_whitespace: return ( - remove_whitespace(before, line_separator=line_separator).strip() - != remove_whitespace(after, line_separator=line_separator).strip() + remove_whitespace(before, line_separator=line_separator).rstrip() + != remove_whitespace(after, line_separator=line_separator).rstrip() ) - return before.strip() != after.strip() + return before.rstrip() != after.rstrip()