Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-flake8-bugbear for openSUSE:Factory checked in at 2023-04-28 16:24:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-flake8-bugbear (Old) and /work/SRC/openSUSE:Factory/.python-flake8-bugbear.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-flake8-bugbear" Fri Apr 28 16:24:13 2023 rev:12 rq:1083470 version:23.3.23 Changes: -------- --- /work/SRC/openSUSE:Factory/python-flake8-bugbear/python-flake8-bugbear.changes 2023-02-23 16:53:18.113099494 +0100 +++ /work/SRC/openSUSE:Factory/.python-flake8-bugbear.new.1533/python-flake8-bugbear.changes 2023-04-28 16:25:17.758685317 +0200 @@ -1,0 +2,14 @@ +Fri Apr 28 08:01:57 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 23.3.23: + * flake8-bugbear is now >= 3.8.1 project like flake8>=6.0.0 + * This has allowed some more modern AST usage cleanup and less + CI running etc. + * B030: Fix crash on certain unusual except handlers (e.g. + ``except a[0].b:``) + * B950: now ignores 'noqa' and 'type: ignore' comments. + * B005: Do not flag when using the ``strip()`` method on an + imported module. + * B030: Allow calls and starred expressions in except handlers. + +------------------------------------------------------------------- Old: ---- flake8-bugbear-23.2.13.tar.gz New: ---- flake8-bugbear-23.3.23.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-flake8-bugbear.spec ++++++ --- /var/tmp/diff_new_pack.6XYsru/_old 2023-04-28 16:25:25.562730868 +0200 +++ /var/tmp/diff_new_pack.6XYsru/_new 2023-04-28 16:25:25.566730891 +0200 @@ -19,7 +19,7 @@ %define skip_python2 1 %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-flake8-bugbear -Version: 23.2.13 +Version: 23.3.23 Release: 0 Summary: A plugin for flake8 finding likely bugs and design problems in your program License: MIT @@ -27,8 +27,8 @@ URL: https://github.com/PyCQA/flake8-bugbear Source: https://files.pythonhosted.org/packages/source/f/flake8-bugbear/flake8-bugbear-%{version}.tar.gz BuildRequires: %{python_module attrs >= 19.2.0} -BuildRequires: %{python_module base >= 3.6} -BuildRequires: %{python_module flake8 >= 3.0.0} +BuildRequires: %{python_module base >= 3.8} +BuildRequires: %{python_module flake8 >= 6.0.0} BuildRequires: %{python_module hypothesis} BuildRequires: %{python_module hypothesmith} BuildRequires: %{python_module pytest} @@ -36,7 +36,7 @@ BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-attrs >= 19.2.0 -Requires: python-flake8 >= 3.0.0 +Requires: python-flake8 >= 6.0.0 BuildArch: noarch %python_subpackages ++++++ flake8-bugbear-23.2.13.tar.gz -> flake8-bugbear-23.3.23.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-23.2.13/PKG-INFO new/flake8-bugbear-23.3.23/PKG-INFO --- old/flake8-bugbear-23.2.13/PKG-INFO 2023-02-13 19:08:05.362368600 +0100 +++ new/flake8-bugbear-23.3.23/PKG-INFO 2023-03-23 15:46:17.355725000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: flake8-bugbear -Version: 23.2.13 +Version: 23.3.23 Summary: A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle. Author-email: Åukasz Langa <luk...@langa.pl> License: MIT @@ -15,7 +15,6 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 @@ -23,7 +22,7 @@ Classifier: Programming Language :: Python :: 3 :: Only Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Software Development :: Quality Assurance -Requires-Python: >=3.7 +Requires-Python: >=3.8.1 Description-Content-Type: text/x-rst Provides-Extra: dev License-File: LICENSE @@ -207,7 +206,7 @@ stacklevel of 1 by default. This will only show a stack trace for the line on which the warn method is called. It is therefore recommended to use a stacklevel of 2 or greater to provide more information to the user. -**B029**: Using ``except: ()`` with an empty tuple does not handle/catch anything. Add exceptions to handle. +**B029**: Using ``except ():`` with an empty tuple does not handle/catch anything. Add exceptions to handle. **B030**: Except handlers should only be exception classes or tuples of exception classes. @@ -260,7 +259,7 @@ **B950**: Line too long. This is a pragmatic equivalent of ``pycodestyle``'s ``E501``: it considers "max-line-length" but only triggers -when the value has been exceeded by **more than 10%**. You will no +when the value has been exceeded by **more than 10%**. ``noqa`` and ``type: ignore`` comments are ignored. You will no longer be forced to reformat code due to the closing parenthesis being one character too far to satisfy the linter. At the same time, if you do significantly violate the line length, you will receive a message that @@ -355,8 +354,22 @@ Change Log ---------- +23.3.23 +~~~~~~~~~~ + +* flake8-bugbear is now >= 3.8.1 project like flake8>=6.0.0 + * This has allowed some more modern AST usage cleanup and less CI running etc. +* B030: Fix crash on certain unusual except handlers (e.g. ``except a[0].b:``) + +23.3.12 +~~~~~~~~ + +* B950: now ignores 'noqa' and 'type: ignore' comments. +* B005: Do not flag when using the ``strip()`` method on an imported module. +* B030: Allow calls and starred expressions in except handlers. + 23.2.13 -~~~~~~~~~ +~~~~~~~~ * B906: Add ``visit_Bytes``, ``visit_Num`` and ``visit_Str`` to the list of ``visit_*`` functions that are ignored by the B906 check. The ``ast.Bytes``, ``ast.Num`` and @@ -364,7 +377,10 @@ order to maintain backwards compatibility with Python 3.7. * B016: Warn when raising f-strings. * Add B028: Check for an explicit stacklevel keyword argument on the warn method from the warnings module. -* Add B029: Check when trying to use ``except`` with an empty tuple i.e. ``except: ()``. +* Add B029: Check when trying to use ``except`` with an empty tuple i.e. ``except ():``. +* Add B030: Check that except handlers only use exception classes or tuples of exception classes. + Fixes crash on some rare except handlers. +* Add B031: Check that ``itertools.groupby()`` is not used multiple times. * Add B032: Check for possible unintentional type annotations instead of assignments. 23.1.20 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-23.2.13/README.rst new/flake8-bugbear-23.3.23/README.rst --- old/flake8-bugbear-23.2.13/README.rst 2023-02-13 19:07:55.000000000 +0100 +++ new/flake8-bugbear-23.3.23/README.rst 2023-03-23 15:46:07.000000000 +0100 @@ -177,7 +177,7 @@ stacklevel of 1 by default. This will only show a stack trace for the line on which the warn method is called. It is therefore recommended to use a stacklevel of 2 or greater to provide more information to the user. -**B029**: Using ``except: ()`` with an empty tuple does not handle/catch anything. Add exceptions to handle. +**B029**: Using ``except ():`` with an empty tuple does not handle/catch anything. Add exceptions to handle. **B030**: Except handlers should only be exception classes or tuples of exception classes. @@ -230,7 +230,7 @@ **B950**: Line too long. This is a pragmatic equivalent of ``pycodestyle``'s ``E501``: it considers "max-line-length" but only triggers -when the value has been exceeded by **more than 10%**. You will no +when the value has been exceeded by **more than 10%**. ``noqa`` and ``type: ignore`` comments are ignored. You will no longer be forced to reformat code due to the closing parenthesis being one character too far to satisfy the linter. At the same time, if you do significantly violate the line length, you will receive a message that @@ -325,8 +325,22 @@ Change Log ---------- +23.3.23 +~~~~~~~~~~ + +* flake8-bugbear is now >= 3.8.1 project like flake8>=6.0.0 + * This has allowed some more modern AST usage cleanup and less CI running etc. +* B030: Fix crash on certain unusual except handlers (e.g. ``except a[0].b:``) + +23.3.12 +~~~~~~~~ + +* B950: now ignores 'noqa' and 'type: ignore' comments. +* B005: Do not flag when using the ``strip()`` method on an imported module. +* B030: Allow calls and starred expressions in except handlers. + 23.2.13 -~~~~~~~~~ +~~~~~~~~ * B906: Add ``visit_Bytes``, ``visit_Num`` and ``visit_Str`` to the list of ``visit_*`` functions that are ignored by the B906 check. The ``ast.Bytes``, ``ast.Num`` and @@ -334,7 +348,10 @@ order to maintain backwards compatibility with Python 3.7. * B016: Warn when raising f-strings. * Add B028: Check for an explicit stacklevel keyword argument on the warn method from the warnings module. -* Add B029: Check when trying to use ``except`` with an empty tuple i.e. ``except: ()``. +* Add B029: Check when trying to use ``except`` with an empty tuple i.e. ``except ():``. +* Add B030: Check that except handlers only use exception classes or tuples of exception classes. + Fixes crash on some rare except handlers. +* Add B031: Check that ``itertools.groupby()`` is not used multiple times. * Add B032: Check for possible unintentional type annotations instead of assignments. 23.1.20 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-23.2.13/bugbear.py new/flake8-bugbear-23.3.23/bugbear.py --- old/flake8-bugbear-23.2.13/bugbear.py 2023-02-13 19:07:55.000000000 +0100 +++ new/flake8-bugbear-23.3.23/bugbear.py 2023-03-23 15:46:07.000000000 +0100 @@ -13,7 +13,7 @@ import attr import pycodestyle -__version__ = "23.2.13" +__version__ = "23.3.23" LOG = logging.getLogger("flake8.bugbear") CONTEXTFUL_NODES = ( @@ -68,24 +68,30 @@ The following simple checks are based on the raw lines, not the AST. """ + noqa_type_ignore_regex = re.compile(r"#\s*(noqa|type:\s*ignore)[^#\r\n]*$") for lineno, line in enumerate(self.lines, start=1): # Special case: ignore long shebang (following pycodestyle). if lineno == 1 and line.startswith("#!"): continue - length = len(line) - 1 - if length > 1.1 * self.max_line_length and line.strip(): + # At first, removing noqa and type: ignore trailing comments" + no_comment_line = noqa_type_ignore_regex.sub("", line) + if no_comment_line != line: + no_comment_line = noqa_type_ignore_regex.sub("", no_comment_line) + + length = len(no_comment_line) - 1 + if length > 1.1 * self.max_line_length and no_comment_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 # to replicate instead. - chunks = line.split() + chunks = no_comment_line.split() is_line_comment_url_path = len(chunks) == 2 and chunks[0] == "#" just_long_url_path = len(chunks) == 1 - num_leading_whitespaces = len(line) - len(chunks[-1]) + num_leading_whitespaces = len(no_comment_line) - len(chunks[-1]) too_many_leading_white_spaces = ( num_leading_whitespaces >= self.max_line_length - 7 ) @@ -129,7 +135,7 @@ help="Skip B008 test for additional immutable calls.", ) - @lru_cache() # noqa: B019 + @lru_cache # noqa: B019 def should_warn(self, code): """Returns `True` if Bugbear should emit a particular warning. @@ -183,18 +189,25 @@ # Return True if arg is a valid identifier, per # https://docs.python.org/2/reference/lexical_analysis.html#identifiers - if not isinstance(arg, ast.Str): + if not isinstance(arg, ast.Constant) or not isinstance(arg.value, str): return False return re.match(r"^[A-Za-z_][A-Za-z0-9_]*$", arg.s) is not None def _flatten_excepthandler(node): - if isinstance(node, ast.Tuple): - for elt in node.elts: - yield from _flatten_excepthandler(elt) - else: + if not isinstance(node, ast.Tuple): yield node + return + expr_list = node.elts.copy() + while len(expr_list): + expr = expr_list.pop(0) + if isinstance(expr, ast.Starred) and isinstance( + expr.value, (ast.List, ast.Tuple) + ): + expr_list.extend(expr.value.elts) + continue + yield expr def _check_redundant_excepthandlers(names, node): @@ -237,15 +250,18 @@ def _to_name_str(node): # Turn Name and Attribute nodes to strings, e.g "ValueError" or # "pkg.mod.error", handling any depth of attribute accesses. + # Return None for unrecognized nodes. if isinstance(node, ast.Name): return node.id if isinstance(node, ast.Call): return _to_name_str(node.func) - assert isinstance(node, ast.Attribute), f"Unexpected node type: {type(node)}" - try: - return _to_name_str(node.value) + "." + node.attr - except AttributeError: - return _to_name_str(node.value) + elif isinstance(node, ast.Attribute): + inner = _to_name_str(node.value) + if inner is None: + return None + return f"{inner}.{node.attr}" + else: + return None def names_from_assignments(assign_target): @@ -293,6 +309,7 @@ NODE_WINDOW_SIZE = 4 _b023_seen = attr.ib(factory=set, init=False) + _b005_imports = attr.ib(factory=set, init=False) if False: # Useful for tracing what the hell is going on. @@ -331,19 +348,30 @@ self.generic_visit(node) return handlers = _flatten_excepthandler(node.type) - good_handlers = [] + names = [] bad_handlers = [] + ignored_handlers = [] for handler in handlers: if isinstance(handler, (ast.Name, ast.Attribute)): - good_handlers.append(handler) + name = _to_name_str(handler) + if name is None: + ignored_handlers.append(handler) + else: + names.append(name) + elif isinstance(handler, (ast.Call, ast.Starred)): + ignored_handlers.append(handler) else: bad_handlers.append(handler) if bad_handlers: self.errors.append(B030(node.lineno, node.col_offset)) - names = [_to_name_str(e) for e in good_handlers] - if len(names) == 0 and not bad_handlers: + if len(names) == 0 and not bad_handlers and not ignored_handlers: self.errors.append(B029(node.lineno, node.col_offset)) - elif len(names) == 1 and not bad_handlers and isinstance(node.type, ast.Tuple): + elif ( + len(names) == 1 + and not bad_handlers + and not ignored_handlers + and isinstance(node.type, ast.Tuple) + ): self.errors.append(B013(node.lineno, node.col_offset, vars=names)) else: maybe_error = _check_redundant_excepthandlers(names, node) @@ -486,25 +514,43 @@ self.check_for_b032(node) self.generic_visit(node) + def visit_Import(self, node): + self.check_for_b005(node) + self.generic_visit(node) + def check_for_b005(self, node): - if node.func.attr not in B005.methods: - return # method name doesn't match + if isinstance(node, ast.Import): + for name in node.names: + self._b005_imports.add(name.asname or name.name) + elif isinstance(node, ast.Call): + if node.func.attr not in B005.methods: + return # method name doesn't match - if len(node.args) != 1 or not isinstance(node.args[0], ast.Str): - return # used arguments don't match the builtin strip + if ( + isinstance(node.func.value, ast.Name) + and node.func.value.id in self._b005_imports + ): + return # method is being run on an imported module + + if ( + len(node.args) != 1 + or not isinstance(node.args[0], ast.Constant) + or not isinstance(node.args[0].value, str) + ): + return # used arguments don't match the builtin strip - call_path = ".".join(compose_call_path(node.func.value)) - if call_path in B005.valid_paths: - return # path is exempt + call_path = ".".join(compose_call_path(node.func.value)) + if call_path in B005.valid_paths: + return # path is exempt - s = node.args[0].s - if len(s) == 1: - return # stripping just one character + s = node.args[0].s + if len(s) == 1: + return # stripping just one character - if len(s) == len(set(s)): - return # no characters appear more than once + if len(s) == len(set(s)): + return # no characters appear more than once - self.errors.append(B005(node.lineno, node.col_offset)) + self.errors.append(B005(node.lineno, node.col_offset)) def check_for_b006_and_b008(self, node): visitor = FuntionDefDefaultsVisitor(self.b008_extend_immutable_calls) @@ -524,7 +570,7 @@ self.errors.append(B007(n.lineno, n.col_offset, vars=(name,))) def check_for_b011(self, node): - if isinstance(node.test, ast.NameConstant) and node.test.value is False: + if isinstance(node.test, ast.Constant) and node.test.value is False: self.errors.append(B011(node.lineno, node.col_offset)) def check_for_b012(self, node): @@ -549,7 +595,13 @@ self.errors.append(B015(node.lineno, node.col_offset)) def check_for_b016(self, node): - if isinstance(node.exc, (ast.NameConstant, ast.Num, ast.Str, ast.JoinedStr)): + if isinstance(node.exc, ast.JoinedStr) or ( + isinstance(node.exc, ast.Constant) + and ( + isinstance(node.exc.value, (int, float, complex, str, bool)) + or node.exc.value is None + ) + ): self.errors.append(B016(node.lineno, node.col_offset)) def check_for_b017(self, node): @@ -732,10 +784,8 @@ def empty_body(body) -> bool: def is_str_or_ellipsis(node): - # ast.Ellipsis and ast.Str used in python<3.8 - return isinstance(node, (ast.Ellipsis, ast.Str)) or ( - isinstance(node, ast.Constant) - and (node.value is Ellipsis or isinstance(node.value, str)) + return isinstance(node, ast.Constant) and ( + node.value is Ellipsis or isinstance(node.value, str) ) # Function body consist solely of `pass`, `...`, and/or (doc)string literals @@ -984,7 +1034,8 @@ if ( body and isinstance(body[0], ast.Expr) - and isinstance(body[0].value, ast.Str) + and isinstance(body[0].value, ast.Constant) + and isinstance(body[0].value.value, str) ): # Ignore the docstring body = body[1:] @@ -1016,13 +1067,16 @@ if isinstance( subnode.value, ( - ast.Num, - ast.Bytes, - ast.NameConstant, ast.List, ast.Set, ast.Dict, ), + ) or ( + isinstance(subnode.value, ast.Constant) + and ( + isinstance(subnode.value.value, (int, float, complex, bytes, bool)) + or subnode.value.value is None + ) ): self.errors.append(B018(subnode.lineno, subnode.col_offset)) @@ -1629,7 +1683,7 @@ ) B029 = Error( message=( - "B029 Using `except: ()` with an empty tuple does not handle/catch " + "B029 Using `except ():` with an empty tuple does not handle/catch " "anything. Add exceptions to handle." ) ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-23.2.13/flake8_bugbear.egg-info/PKG-INFO new/flake8-bugbear-23.3.23/flake8_bugbear.egg-info/PKG-INFO --- old/flake8-bugbear-23.2.13/flake8_bugbear.egg-info/PKG-INFO 2023-02-13 19:08:05.000000000 +0100 +++ new/flake8-bugbear-23.3.23/flake8_bugbear.egg-info/PKG-INFO 2023-03-23 15:46:17.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: flake8-bugbear -Version: 23.2.13 +Version: 23.3.23 Summary: A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle. Author-email: Åukasz Langa <luk...@langa.pl> License: MIT @@ -15,7 +15,6 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 @@ -23,7 +22,7 @@ Classifier: Programming Language :: Python :: 3 :: Only Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Software Development :: Quality Assurance -Requires-Python: >=3.7 +Requires-Python: >=3.8.1 Description-Content-Type: text/x-rst Provides-Extra: dev License-File: LICENSE @@ -207,7 +206,7 @@ stacklevel of 1 by default. This will only show a stack trace for the line on which the warn method is called. It is therefore recommended to use a stacklevel of 2 or greater to provide more information to the user. -**B029**: Using ``except: ()`` with an empty tuple does not handle/catch anything. Add exceptions to handle. +**B029**: Using ``except ():`` with an empty tuple does not handle/catch anything. Add exceptions to handle. **B030**: Except handlers should only be exception classes or tuples of exception classes. @@ -260,7 +259,7 @@ **B950**: Line too long. This is a pragmatic equivalent of ``pycodestyle``'s ``E501``: it considers "max-line-length" but only triggers -when the value has been exceeded by **more than 10%**. You will no +when the value has been exceeded by **more than 10%**. ``noqa`` and ``type: ignore`` comments are ignored. You will no longer be forced to reformat code due to the closing parenthesis being one character too far to satisfy the linter. At the same time, if you do significantly violate the line length, you will receive a message that @@ -355,8 +354,22 @@ Change Log ---------- +23.3.23 +~~~~~~~~~~ + +* flake8-bugbear is now >= 3.8.1 project like flake8>=6.0.0 + * This has allowed some more modern AST usage cleanup and less CI running etc. +* B030: Fix crash on certain unusual except handlers (e.g. ``except a[0].b:``) + +23.3.12 +~~~~~~~~ + +* B950: now ignores 'noqa' and 'type: ignore' comments. +* B005: Do not flag when using the ``strip()`` method on an imported module. +* B030: Allow calls and starred expressions in except handlers. + 23.2.13 -~~~~~~~~~ +~~~~~~~~ * B906: Add ``visit_Bytes``, ``visit_Num`` and ``visit_Str`` to the list of ``visit_*`` functions that are ignored by the B906 check. The ``ast.Bytes``, ``ast.Num`` and @@ -364,7 +377,10 @@ order to maintain backwards compatibility with Python 3.7. * B016: Warn when raising f-strings. * Add B028: Check for an explicit stacklevel keyword argument on the warn method from the warnings module. -* Add B029: Check when trying to use ``except`` with an empty tuple i.e. ``except: ()``. +* Add B029: Check when trying to use ``except`` with an empty tuple i.e. ``except ():``. +* Add B030: Check that except handlers only use exception classes or tuples of exception classes. + Fixes crash on some rare except handlers. +* Add B031: Check that ``itertools.groupby()`` is not used multiple times. * Add B032: Check for possible unintentional type annotations instead of assignments. 23.1.20 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-23.2.13/flake8_bugbear.egg-info/requires.txt new/flake8-bugbear-23.3.23/flake8_bugbear.egg-info/requires.txt --- old/flake8-bugbear-23.2.13/flake8_bugbear.egg-info/requires.txt 2023-02-13 19:08:05.000000000 +0100 +++ new/flake8-bugbear-23.3.23/flake8_bugbear.egg-info/requires.txt 2023-03-23 15:46:17.000000000 +0100 @@ -1,4 +1,4 @@ -flake8>=3.0.0 +flake8>=6.0.0 attrs>=19.2.0 [dev] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-23.2.13/pyproject.toml new/flake8-bugbear-23.3.23/pyproject.toml --- old/flake8-bugbear-23.2.13/pyproject.toml 2023-02-13 19:07:55.000000000 +0100 +++ new/flake8-bugbear-23.3.23/pyproject.toml 2023-03-23 15:46:07.000000000 +0100 @@ -26,7 +26,6 @@ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -35,8 +34,8 @@ "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Quality Assurance", ] -requires-python = ">=3.7" -dependencies = ["flake8 >= 3.0.0", "attrs>=19.2.0"] +requires-python = ">=3.8.1" +dependencies = ["flake8>=6.0.0", "attrs>=19.2.0"] dynamic = ["version"] [project.urls] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-23.2.13/tests/b005.py new/flake8-bugbear-23.3.23/tests/b005.py --- old/flake8-bugbear-23.2.13/tests/b005.py 2023-02-13 19:07:55.000000000 +0100 +++ new/flake8-bugbear-23.3.23/tests/b005.py 2023-03-23 15:46:07.000000000 +0100 @@ -24,3 +24,10 @@ other_type().lstrip() # no warning other_type().rstrip(["a", "b", "c"]) # no warning other_type().strip("a", "b") # no warning + +import test, test2 # isort: skip +import test_as as test3 + +test.strip("test") # no warning +test2.strip("test") # no warning +test3.strip("test") # no warning diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-23.2.13/tests/b030.py new/flake8-bugbear-23.3.23/tests/b030.py --- old/flake8-bugbear-23.2.13/tests/b030.py 2023-02-13 19:07:55.000000000 +0100 +++ new/flake8-bugbear-23.3.23/tests/b030.py 2023-03-23 15:46:07.000000000 +0100 @@ -1,6 +1,11 @@ try: pass -except (ValueError, (RuntimeError, (KeyError, TypeError))): # ok +except (ValueError, (RuntimeError, (KeyError, TypeError))): # error + pass + +try: + pass +except (ValueError, *(RuntimeError, *(KeyError, TypeError))): # ok pass try: @@ -12,3 +17,24 @@ pass except (1, ValueError): # error pass + +try: + pass +except (ValueError, *(RuntimeError, TypeError)): # ok + pass + + +def what_to_catch(): + return (ValueError, TypeError) + + +try: + pass +except what_to_catch(): # ok + pass + + +try: + pass +except a.b[1].c: # ok + pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-23.2.13/tests/b031.py new/flake8-bugbear-23.3.23/tests/b031.py --- old/flake8-bugbear-23.2.13/tests/b031.py 2023-02-13 19:07:55.000000000 +0100 +++ new/flake8-bugbear-23.3.23/tests/b031.py 2023-03-23 15:46:07.000000000 +0100 @@ -1,6 +1,6 @@ """ Should emit: -B030 - on lines 29, 33, 43 +B031 - on lines 30, 34, 43 """ import itertools from itertools import groupby diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-23.2.13/tests/b950.py new/flake8-bugbear-23.3.23/tests/b950.py --- old/flake8-bugbear-23.2.13/tests/b950.py 2023-02-13 19:07:55.000000000 +0100 +++ new/flake8-bugbear-23.3.23/tests/b950.py 2023-03-23 15:46:07.000000000 +0100 @@ -24,3 +24,13 @@ """ """ +"https://foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.com # noqa" +"https://foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.com # type: ignore" +"https://foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.com # noqa: F401" +"https://foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.com#noqa:F401, B950" +"https://foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.com # type: ignore[some-code]" +"https://foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.com # type: ignore[some-code]" +"https://foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.com # type: ignore[some-code] # noqa: F401" +"https://foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.com # noqa: F401 # type:ignore[some-code]" +"NOT OK: https://foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.com # noqa" +"NOT OK: https://foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.com # type: ignore" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-23.2.13/tests/test_bugbear.py new/flake8-bugbear-23.3.23/tests/test_bugbear.py --- old/flake8-bugbear-23.2.13/tests/test_bugbear.py 2023-02-13 19:07:55.000000000 +0100 +++ new/flake8-bugbear-23.3.23/tests/test_bugbear.py 2023-03-23 15:46:07.000000000 +0100 @@ -456,8 +456,9 @@ bbc = BugBearChecker(filename=str(filename)) errors = list(bbc.run()) expected = self.errors( - B030(8, 0), + B030(3, 0), B030(13, 0), + B030(18, 0), ) self.assertEqual(errors, expected) @@ -689,6 +690,8 @@ B950(12, 103, vars=(103, 79)), B950(14, 103, vars=(103, 79)), B950(21, 97, vars=(97, 79)), + B950(35, 104, vars=(104, 79)), + B950(36, 104, vars=(104, 79)), ), ) @@ -705,6 +708,8 @@ B950(12, 103, vars=(103, 79)), B950(14, 103, vars=(103, 79)), B950(21, 97, vars=(97, 79)), + B950(35, 104, vars=(104, 79)), + B950(36, 104, vars=(104, 79)), ), ) @@ -723,6 +728,8 @@ B950(12, 103, vars=(103, 79)), B950(14, 103, vars=(103, 79)), B950(21, 97, vars=(97, 79)), + B950(35, 104, vars=(104, 79)), + B950(36, 104, vars=(104, 79)), ), ) @@ -740,8 +747,7 @@ filename = Path(__file__).absolute().parent.parent / "bugbear.py" proc = subprocess.run( ["flake8", str(filename)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, timeout=60, ) self.assertEqual(proc.returncode, 0, proc.stdout.decode("utf8")) @@ -752,8 +758,7 @@ filename = Path(__file__).absolute() proc = subprocess.run( ["flake8", str(filename)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, timeout=60, ) self.assertEqual(proc.returncode, 0, proc.stdout.decode("utf8"))