From 35a3f9a2da50a0cf872be8ebb0a94e6f71e44a73 Mon Sep 17 00:00:00 2001 From: mikhail-melnik Date: Thu, 24 Feb 2022 18:04:04 +0100 Subject: [PATCH] Fix crash on long empty string --- bugbear.py | 2 +- tests/b950.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bugbear.py b/bugbear.py index 177af11..010e095 100644 --- a/bugbear.py +++ b/bugbear.py @@ -72,7 +72,7 @@ def gen_line_based_checks(self): continue length = len(line) - 1 - if length > 1.1 * self.max_line_length: + if length > 1.1 * self.max_line_length and line.strip(): # Special case long URLS and paths to follow pycodestyle. # Would use the `pycodestyle.maximum_line_length` directly but # need to supply it arguments that are not available so chose diff --git a/tests/b950.py b/tests/b950.py index 942e50c..0dbded1 100644 --- a/tests/b950.py +++ b/tests/b950.py @@ -19,3 +19,8 @@ # This # almost_empty_line_too_long + +# Long empty line +""" + +"""