From 6d77d23a02584d28f162db9f9a48a5af413bbcc3 Mon Sep 17 00:00:00 2001 From: Katsuhiko Nishimra Date: Thu, 21 Mar 2024 15:46:55 +0900 Subject: [PATCH 1/3] Ignore flake8 E701/704 because it conflicts with recent black --- pysen/ext/flake8_wrapper.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pysen/ext/flake8_wrapper.py b/pysen/ext/flake8_wrapper.py index f2e4de9..8d9c468 100644 --- a/pysen/ext/flake8_wrapper.py +++ b/pysen/ext/flake8_wrapper.py @@ -66,6 +66,20 @@ def to_black_compatible(self) -> "Flake8Setting": "# E501: black may exceed the line-length to follow other style rules" ) + if not _contains(new.ignore, "E701"): + new.ignore.append("E701") + new._comments.append( + # cf. https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#e701-e704 + "# E701: black will collapse implementations of classes and functions consisting solely of ... to a single line" + ) + + if not _contains(new.ignore, "E704"): + new.ignore.append("E704") + new._comments.append( + # cf. https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#e701-e704 + "# E704: black will collapse implementations of classes and functions consisting solely of ... to a single line" + ) + W503_or_504_enabled = _contains(new.ignore, "W503") or _contains( new.ignore, "W504" ) From de500135f3fa6db88638afaa67d844297a99ca79 Mon Sep 17 00:00:00 2001 From: Katsuhiko Nishimra Date: Thu, 21 Mar 2024 17:27:37 +0900 Subject: [PATCH 2/3] Shorter comments --- pysen/ext/flake8_wrapper.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pysen/ext/flake8_wrapper.py b/pysen/ext/flake8_wrapper.py index 8d9c468..eb48072 100644 --- a/pysen/ext/flake8_wrapper.py +++ b/pysen/ext/flake8_wrapper.py @@ -69,15 +69,13 @@ def to_black_compatible(self) -> "Flake8Setting": if not _contains(new.ignore, "E701"): new.ignore.append("E701") new._comments.append( - # cf. https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#e701-e704 - "# E701: black will collapse implementations of classes and functions consisting solely of ... to a single line" + "# E704: black will collapse ... only functions etc. to a single line" ) if not _contains(new.ignore, "E704"): new.ignore.append("E704") new._comments.append( - # cf. https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#e701-e704 - "# E704: black will collapse implementations of classes and functions consisting solely of ... to a single line" + "# E704: black will collapse ... only functions etc. to a single line" ) W503_or_504_enabled = _contains(new.ignore, "W503") or _contains( From c81c034a14cb00e39063e5c62f6510990bdf77a9 Mon Sep 17 00:00:00 2001 From: Katsuhiko Nishimra Date: Thu, 21 Mar 2024 17:29:44 +0900 Subject: [PATCH 3/3] fix a typo --- pysen/ext/flake8_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pysen/ext/flake8_wrapper.py b/pysen/ext/flake8_wrapper.py index eb48072..5fd8fb7 100644 --- a/pysen/ext/flake8_wrapper.py +++ b/pysen/ext/flake8_wrapper.py @@ -69,7 +69,7 @@ def to_black_compatible(self) -> "Flake8Setting": if not _contains(new.ignore, "E701"): new.ignore.append("E701") new._comments.append( - "# E704: black will collapse ... only functions etc. to a single line" + "# E701: black will collapse ... only functions etc. to a single line" ) if not _contains(new.ignore, "E704"):