Hello community,

here is the log from the commit of package python-flake8-bugbear for 
openSUSE:Factory checked in at 2019-04-02 09:22:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flake8-bugbear (Old)
 and      /work/SRC/openSUSE:Factory/.python-flake8-bugbear.new.25356 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-flake8-bugbear"

Tue Apr  2 09:22:57 2019 rev:4 rq:690380 version:19.3.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-flake8-bugbear/python-flake8-bugbear.changes  
    2018-11-06 14:38:24.120685500 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-flake8-bugbear.new.25356/python-flake8-bugbear.changes
   2019-04-02 09:23:04.304740769 +0200
@@ -1,0 +2,10 @@
+Mon Apr  1 13:29:24 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 19.3.0:
+  * allow 'mcs' for metaclass classmethod first arg (PyCharm default)
+  * Introduce B011
+  * Introduce B009 and B010
+  * Exclude immutable calls like tuple() and frozenset() from B008
+  * For B902, the first argument for metaclass class methods can be "mcs", 
matching the name preferred by PyCharm.
+
+-------------------------------------------------------------------

Old:
----
  flake8-bugbear-18.8.0.tar.gz

New:
----
  flake8-bugbear-19.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-flake8-bugbear.spec ++++++
--- /var/tmp/diff_new_pack.akOnfm/_old  2019-04-02 09:23:06.072741955 +0200
+++ /var/tmp/diff_new_pack.akOnfm/_new  2019-04-02 09:23:06.076741958 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-flake8-bugbear
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %define skip_python2 1
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-flake8-bugbear
-Version:        18.8.0
+Version:        19.3.0
 Release:        0
 Summary:        A plugin for flake8 finding likely bugs and design problems in 
your program
 License:        MIT
@@ -54,6 +54,8 @@
 %python_exec setup.py test
 
 %files %{python_files}
+%license LICENSE
+%doc README.rst
 %{python_sitelib}/*
 
 %changelog

++++++ flake8-bugbear-18.8.0.tar.gz -> flake8-bugbear-19.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-bugbear-18.8.0/PKG-INFO 
new/flake8-bugbear-19.3.0/PKG-INFO
--- old/flake8-bugbear-18.8.0/PKG-INFO  2018-08-14 00:14:42.000000000 +0200
+++ new/flake8-bugbear-19.3.0/PKG-INFO  2019-03-28 18:09:59.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: flake8-bugbear
-Version: 18.8.0
+Version: 19.3.0
 Summary: A plugin for flake8 finding likely bugs and design problems in your 
program. Contains warnings that don't belong in pyflakes and pycodestyle.
 Home-page: https://github.com/PyCQA/flake8-bugbear
 Author: Łukasz Langa
@@ -88,6 +88,19 @@
         intended, assign the function call to a module-level variable and use
         that variable as a default value.
         
+        **B009**: Do not call ``getattr(x, 'attr')``, instead use normal
+        property access: ``x.attr``. Missing a default to ``getattr`` will 
cause
+        an ``AttributeError`` to be raised for non-existent properties. There 
is
+        no additional safety in using ``getattr`` if you know the attribute 
name
+        ahead of time.
+        
+        **B010**: Do not call ``setattr(x, 'attr', val)``, instead use normal
+        property access: ``x.attr = val``. There is no additional safety in
+        using ``setattr`` if you know the attribute name ahead of time.
+        
+        **B011**: Do not call `assert False` since `python -O` removes these 
calls.
+        Instead callers should `raise AssertionError()`.
+        
         
         Python 3 compatibility warnings
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -231,6 +244,23 @@
         Change Log
         ----------
         
+        19.3.0
+        ~~~~~~
+        
+        * allow 'mcs' for metaclass classmethod first arg (PyCharm default)
+        * Introduce B011
+        * Introduce B009 and B010
+        * Exclude immutable calls like tuple() and frozenset() from B008
+        * For B902, the first argument for metaclass class methods can be
+          "mcs", matching the name preferred by PyCharm.
+        
+        18.8.0
+        ~~~~~~
+        
+        * black format all .py files
+        * Examine kw-only args for mutable defaults
+        * Test for Python 3.7
+        
         18.2.0
         ~~~~~~
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-bugbear-18.8.0/README.rst 
new/flake8-bugbear-19.3.0/README.rst
--- old/flake8-bugbear-18.8.0/README.rst        2018-08-13 23:47:30.000000000 
+0200
+++ new/flake8-bugbear-19.3.0/README.rst        2019-03-28 18:08:51.000000000 
+0100
@@ -80,6 +80,19 @@
 intended, assign the function call to a module-level variable and use
 that variable as a default value.
 
+**B009**: Do not call ``getattr(x, 'attr')``, instead use normal
+property access: ``x.attr``. Missing a default to ``getattr`` will cause
+an ``AttributeError`` to be raised for non-existent properties. There is
+no additional safety in using ``getattr`` if you know the attribute name
+ahead of time.
+
+**B010**: Do not call ``setattr(x, 'attr', val)``, instead use normal
+property access: ``x.attr = val``. There is no additional safety in
+using ``setattr`` if you know the attribute name ahead of time.
+
+**B011**: Do not call `assert False` since `python -O` removes these calls.
+Instead callers should `raise AssertionError()`.
+
 
 Python 3 compatibility warnings
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -223,6 +236,23 @@
 Change Log
 ----------
 
+19.3.0
+~~~~~~
+
+* allow 'mcs' for metaclass classmethod first arg (PyCharm default)
+* Introduce B011
+* Introduce B009 and B010
+* Exclude immutable calls like tuple() and frozenset() from B008
+* For B902, the first argument for metaclass class methods can be
+  "mcs", matching the name preferred by PyCharm.
+
+18.8.0
+~~~~~~
+
+* black format all .py files
+* Examine kw-only args for mutable defaults
+* Test for Python 3.7
+
 18.2.0
 ~~~~~~
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-bugbear-18.8.0/bugbear.py 
new/flake8-bugbear-19.3.0/bugbear.py
--- old/flake8-bugbear-18.8.0/bugbear.py        2018-08-14 00:13:47.000000000 
+0200
+++ new/flake8-bugbear-19.3.0/bugbear.py        2019-03-28 18:08:51.000000000 
+0100
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3
 import ast
 from collections import namedtuple
 from contextlib import suppress
@@ -10,7 +9,7 @@
 import pycodestyle
 
 
-__version__ = "18.8.0"
+__version__ = "19.3.0"
 
 LOG = logging.getLogger("flake8.bugbear")
 
@@ -164,6 +163,18 @@
                     and node.args[1].s == "__call__"  # noqa: W503
                 ):
                     self.errors.append(B004(node.lineno, node.col_offset))
+                if (
+                    node.func.id == "getattr"
+                    and len(node.args) == 2  # noqa: W503
+                    and isinstance(node.args[1], ast.Str)  # noqa: W503
+                ):
+                    self.errors.append(B009(node.lineno, node.col_offset))
+                elif (
+                    node.func.id == "setattr"
+                    and len(node.args) == 3  # noqa: W503
+                    and isinstance(node.args[1], ast.Str)  # noqa: W503
+                ):
+                    self.errors.append(B010(node.lineno, node.col_offset))
 
         self.generic_visit(node)
 
@@ -196,6 +207,10 @@
         self.check_for_b007(node)
         self.generic_visit(node)
 
+    def visit_Assert(self, node):
+        self.check_for_b011(node)
+        self.generic_visit(node)
+
     def visit_AsyncFunctionDef(self, node):
         self.check_for_b902(node)
         self.check_for_b006(node)
@@ -246,7 +261,7 @@
                 call_path = ".".join(self.compose_call_path(default.func))
                 if call_path in B006.mutable_calls:
                     self.errors.append(B006(default.lineno, 
default.col_offset))
-                else:
+                elif call_path not in B008.immutable_calls:
                     self.errors.append(B008(default.lineno, 
default.col_offset))
 
     def check_for_b007(self, node):
@@ -261,6 +276,10 @@
             n = targets.names[name][0]
             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:
+            self.errors.append(B011(node.lineno, node.col_offset))
+
     def check_for_b901(self, node):
         xs = list(node.body)
         has_yield = False
@@ -470,6 +489,22 @@
     "this is intended, assign the function call to a module-level "
     "variable and use that variable as a default value."
 )
+B008.immutable_calls = {
+    'tuple',
+    'frozenset',
+}
+B009 = Error(
+    message="B009 Do not call getattr with a constant attribute value, "
+    "it is not any safer than normal property access."
+)
+B010 = Error(
+    message="B010 Do not call setattr with a constant attribute value, "
+    "it is not any safer than normal property access."
+)
+B011 = Error(
+    message="B011 Do not call assert False since python -O removes these 
calls. "
+            "Instead callers should raise AssertionError()."
+)
 
 
 # Those could be false positives but it's more dangerous to let them slip
@@ -525,10 +560,10 @@
     message="B902 Invalid first argument {} used for {} method. Use the "
     "canonical first argument name in methods, i.e. {}."
 )
-B902.implicit_classmethods = {"__new__", "__init_subclass__"}
+B902.implicit_classmethods = {"__new__", "__init_subclass__", 
"__class_getitem__"}
 B902.self = ["self"]  # it's a list because the first is preferred
 B902.cls = ["cls", "klass"]  # ditto.
-B902.metacls = ["metacls", "metaclass", "typ"]  # ditto.
+B902.metacls = ["metacls", "metaclass", "typ", "mcs"]  # ditto.
 
 B903 = Error(
     message="B903 Data class should either be immutable or use __slots__ to "
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/flake8-bugbear-18.8.0/flake8_bugbear.egg-info/PKG-INFO 
new/flake8-bugbear-19.3.0/flake8_bugbear.egg-info/PKG-INFO
--- old/flake8-bugbear-18.8.0/flake8_bugbear.egg-info/PKG-INFO  2018-08-14 
00:14:42.000000000 +0200
+++ new/flake8-bugbear-19.3.0/flake8_bugbear.egg-info/PKG-INFO  2019-03-28 
18:09:59.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: flake8-bugbear
-Version: 18.8.0
+Version: 19.3.0
 Summary: A plugin for flake8 finding likely bugs and design problems in your 
program. Contains warnings that don't belong in pyflakes and pycodestyle.
 Home-page: https://github.com/PyCQA/flake8-bugbear
 Author: Łukasz Langa
@@ -88,6 +88,19 @@
         intended, assign the function call to a module-level variable and use
         that variable as a default value.
         
+        **B009**: Do not call ``getattr(x, 'attr')``, instead use normal
+        property access: ``x.attr``. Missing a default to ``getattr`` will 
cause
+        an ``AttributeError`` to be raised for non-existent properties. There 
is
+        no additional safety in using ``getattr`` if you know the attribute 
name
+        ahead of time.
+        
+        **B010**: Do not call ``setattr(x, 'attr', val)``, instead use normal
+        property access: ``x.attr = val``. There is no additional safety in
+        using ``setattr`` if you know the attribute name ahead of time.
+        
+        **B011**: Do not call `assert False` since `python -O` removes these 
calls.
+        Instead callers should `raise AssertionError()`.
+        
         
         Python 3 compatibility warnings
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -231,6 +244,23 @@
         Change Log
         ----------
         
+        19.3.0
+        ~~~~~~
+        
+        * allow 'mcs' for metaclass classmethod first arg (PyCharm default)
+        * Introduce B011
+        * Introduce B009 and B010
+        * Exclude immutable calls like tuple() and frozenset() from B008
+        * For B902, the first argument for metaclass class methods can be
+          "mcs", matching the name preferred by PyCharm.
+        
+        18.8.0
+        ~~~~~~
+        
+        * black format all .py files
+        * Examine kw-only args for mutable defaults
+        * Test for Python 3.7
+        
         18.2.0
         ~~~~~~
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/flake8-bugbear-18.8.0/flake8_bugbear.egg-info/SOURCES.txt 
new/flake8-bugbear-19.3.0/flake8_bugbear.egg-info/SOURCES.txt
--- old/flake8-bugbear-18.8.0/flake8_bugbear.egg-info/SOURCES.txt       
2018-08-14 00:14:42.000000000 +0200
+++ new/flake8-bugbear-19.3.0/flake8_bugbear.egg-info/SOURCES.txt       
2019-03-28 18:09:59.000000000 +0100
@@ -19,6 +19,8 @@
 tests/b005.py
 tests/b006_b008.py
 tests/b007.py
+tests/b009_b010.py
+tests/b011.py
 tests/b301_b302_b305.py
 tests/b303_b304.py
 tests/b306.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-bugbear-18.8.0/tests/b006_b008.py 
new/flake8-bugbear-19.3.0/tests/b006_b008.py
--- old/flake8-bugbear-18.8.0/tests/b006_b008.py        2018-08-13 
23:47:30.000000000 +0200
+++ new/flake8-bugbear-19.3.0/tests/b006_b008.py        2019-03-27 
01:53:19.000000000 +0100
@@ -7,6 +7,10 @@
     ...
 
 
+def and_this_also(value=tuple()):
+    pass
+
+
 def this_is_wrong(value=[1, 2, 3]):
     ...
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-bugbear-18.8.0/tests/b009_b010.py 
new/flake8-bugbear-19.3.0/tests/b009_b010.py
--- old/flake8-bugbear-18.8.0/tests/b009_b010.py        1970-01-01 
01:00:00.000000000 +0100
+++ new/flake8-bugbear-19.3.0/tests/b009_b010.py        2019-03-27 
01:53:19.000000000 +0100
@@ -0,0 +1,22 @@
+"""
+Should emit:
+B009 - Line 15
+B010 - Line 22
+"""
+
+# Valid getattr usage
+getattr(foo, bar)
+getattr(foo, "bar", None)
+getattr(foo, "bar{foo}".format(foo="a"), None)
+getattr(foo, "bar{foo}".format(foo="a"))
+getattr(foo, bar, None)
+
+# Invalid usage
+getattr(foo, "bar")
+
+# Valid setattr usage
+setattr(foo, bar, None)
+setattr(foo, "bar{foo}".format(foo="a"), None)
+
+# Invalid usage
+setattr(foo, "bar", None)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-bugbear-18.8.0/tests/b011.py 
new/flake8-bugbear-19.3.0/tests/b011.py
--- old/flake8-bugbear-18.8.0/tests/b011.py     1970-01-01 01:00:00.000000000 
+0100
+++ new/flake8-bugbear-19.3.0/tests/b011.py     2019-03-27 01:53:19.000000000 
+0100
@@ -0,0 +1,10 @@
+"""
+Should emit:
+B011 - on line 8
+B011 - on line 10
+"""
+
+assert 1 != 2
+assert False
+assert 1 != 2, "message"
+assert False, "message"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-bugbear-18.8.0/tests/b902.py 
new/flake8-bugbear-19.3.0/tests/b902.py
--- old/flake8-bugbear-18.8.0/tests/b902.py     2018-07-14 18:39:21.000000000 
+0200
+++ new/flake8-bugbear-19.3.0/tests/b902.py     2019-03-27 01:53:19.000000000 
+0100
@@ -72,6 +72,10 @@
     def __prepare__(cls, name, bases):
         return {}
 
+    @classmethod
+    def first_arg_mcs_allowed(mcs, value):
+        ...
+
 
 def type_factory():
     return object
@@ -85,3 +89,14 @@
 class RuntimeError("This is not a base"):
     def __init__(self):
         ...
+
+
+class ImplicitClassMethods:
+    def __new__(cls, *args, **kwargs):
+        ...
+
+    def __init_subclass__(cls, *args, **kwargs):
+        ...
+
+    def __class_getitem__(cls, key):
+        ...
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-bugbear-18.8.0/tests/test_bugbear.py 
new/flake8-bugbear-19.3.0/tests/test_bugbear.py
--- old/flake8-bugbear-18.8.0/tests/test_bugbear.py     2018-08-13 
23:47:30.000000000 +0200
+++ new/flake8-bugbear-19.3.0/tests/test_bugbear.py     2019-03-27 
01:53:19.000000000 +0100
@@ -12,6 +12,9 @@
     B006,
     B007,
     B008,
+    B009,
+    B010,
+    B011,
     B301,
     B302,
     B303,
@@ -78,13 +81,13 @@
         self.assertEqual(
             errors,
             self.errors(
-                B006(10, 24),
-                B006(14, 29),
-                B006(18, 19),
+                B006(14, 24),
+                B006(18, 29),
                 B006(22, 19),
-                B006(26, 31),
-                B008(35, 38),
-                B006(49, 32),
+                B006(26, 19),
+                B006(30, 31),
+                B008(39, 38),
+                B006(53, 32),
             ),
         )
 
@@ -102,6 +105,21 @@
             ),
         )
 
+    def test_b009_b010(self):
+        filename = Path(__file__).absolute().parent / "b009_b010.py"
+        bbc = BugBearChecker(filename=str(filename))
+        errors = list(bbc.run())
+        self.assertEqual(errors, self.errors(B009(15, 0), B010(22, 0)))
+
+    def test_b011(self):
+        filename = Path(__file__).absolute().parent / 'b011.py'
+        bbc = BugBearChecker(filename=str(filename))
+        errors = list(bbc.run())
+        self.assertEqual(
+            errors,
+            self.errors(B011(8, 0, vars=('i',)), B011(10, 0, vars=('k',))),
+        )
+
     def test_b301_b302_b305(self):
         filename = Path(__file__).absolute().parent / "b301_b302_b305.py"
         bbc = BugBearChecker(filename=str(filename))


Reply via email to