Hello community,
here is the log from the commit of package python-flake8-bugbear for openSUSE:Factory checked in at 2018-11-06 14:37:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flake8-bugbear (Old)
and /work/SRC/openSUSE:Factory/.python-flake8-bugbear.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-flake8-bugbear"
Tue Nov 6 14:37:33 2018 rev:3 rq:646250 version:18.8.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-flake8-bugbear/python-flake8-bugbear.changes 2018-07-18 22:58:04.850136914 +0200
+++ /work/SRC/openSUSE:Factory/.python-flake8-bugbear.new/python-flake8-bugbear.changes 2018-11-06 14:38:24.120685500 +0100
@@ -1,0 +2,13 @@
+Fri Nov 2 21:34:53 UTC 2018 - Matej Cepl
+
+- Update to 18.8.0:
+ * Exclude immutable calls like tuple() and frozenset() from B008
+ * Examine kw-only args for mutable defaults
+ * Black all the .py files - Like one should (#48)
+ * Add testing and document support for the Python 3.7 release
+ * Avoid adding the visitor as an __init__ parameter (Fixes #39)
+ (#40)
+ * Add trove classifier 'Programming Language :: Python :: 3 :: Only'
+ * Fix pathlib link in readme (#36)
+
+-------------------------------------------------------------------
Old:
----
flake8-bugbear-18.2.0.tar.gz
New:
----
flake8-bugbear-18.8.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-flake8-bugbear.spec ++++++
--- /var/tmp/diff_new_pack.040Db7/_old 2018-11-06 14:38:25.888682828 +0100
+++ /var/tmp/diff_new_pack.040Db7/_new 2018-11-06 14:38:25.892682821 +0100
@@ -12,26 +12,27 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
+%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-flake8-bugbear
-Version: 18.2.0
+Version: 18.8.0
Release: 0
Summary: A plugin for flake8 finding likely bugs and design problems in your program
License: MIT
Group: Development/Languages/Python
-Url: https://github.com/PyCQA/flake8-bugbear
+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 base >= 3.5}
+BuildRequires: %{python_module attrs}
+BuildRequires: %{python_module base}
+BuildRequires: %{python_module flake8 >= 3.0.0}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
-
%python_subpackages
%description
@@ -49,6 +50,9 @@
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
+%check
+%python_exec setup.py test
+
%files %{python_files}
%{python_sitelib}/*
++++++ flake8-bugbear-18.2.0.tar.gz -> flake8-bugbear-18.8.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/PKG-INFO new/flake8-bugbear-18.8.0/PKG-INFO
--- old/flake8-bugbear-18.2.0/PKG-INFO 2018-02-05 14:13:59.000000000 +0100
+++ new/flake8-bugbear-18.8.0/PKG-INFO 2018-08-14 00:14:42.000000000 +0200
@@ -1,12 +1,11 @@
Metadata-Version: 1.2
Name: flake8-bugbear
-Version: 18.2.0
+Version: 18.8.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
Author-email: lukasz@langa.pl
License: MIT
-Description-Content-Type: UNKNOWN
Description: ==============
flake8-bugbear
==============
@@ -14,6 +13,9 @@
.. image:: https://travis-ci.org/PyCQA/flake8-bugbear.svg?branch=master
:target: https://travis-ci.org/PyCQA/flake8-bugbear
+ .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
+ :target: https://github.com/ambv/black
+
A plugin for Flake8 finding likely bugs and design problems in your
program. Contains warnings that don't belong in pyflakes and
pycodestyle::
@@ -29,6 +31,22 @@
3. A fearsome imaginary creature, especially one evoked to frighten
children.
+ Installation
+ ------------
+
+ Install from ``pip`` with:
+
+ .. code-block:: sh
+
+ pip install flake8-bugbear
+
+ It will then automatically be run as part of ``flake8``; you can check it has
+ been picked up with:
+
+ .. code-block:: sh
+
+ $ flake8 --version
+ 3.5.0 (assertive: 1.0.1, flake8-bugbear: 18.2.0, flake8-comprehensions: 1.4.1, mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 3.7.0 on Darwin
List of warnings
----------------
@@ -195,12 +213,12 @@
If you're still invested in Python 2, there might be a small subset of
deprecated syntax that you'd have to abandon... but you're already doing
- that, right? `six https://pypi.python.org/pypi/six`_ or
- `python-future https://pypi.python.org/pypi/future`_ bridge the gaps.
+ that, right? `six https://pypi.org/project/six/`_ or
+ `python-future https://pypi.org/project/future/`_ bridge the gaps.
By making the code exclusively Python 3.5+, I'm able to focus on the
quality of the checks and re-use all the nice features of the new
- releases (check out `pathlib `_)
+ releases (check out `pathlib https://docs.python.org/3/library/pathlib.html`_)
instead of wasting cycles on Unicode compatibility, etc.
@@ -353,8 +371,8 @@
Glued together by `Łukasz Langa mailto:lukasz@langa.pl`_. Multiple
improvements by `Markus Unterwaditzer mailto:markus@unterwaditzer.net`_,
- `Martijn Pieters mailto:github.com@zopatista.com`_, and
- `Cooper Lees mailto:me@cooperlees.com`_.
+ `Martijn Pieters mailto:github.com@zopatista.com`_,
+ `Cooper Lees mailto:me@cooperlees.com`_, and `Ryan May mailto:rmay31@gmail.com`.
Keywords: flake8 bugbear bugs pyflakes pylint linter qa
Platform: UNKNOWN
@@ -368,6 +386,8 @@
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/README.rst new/flake8-bugbear-18.8.0/README.rst
--- old/flake8-bugbear-18.2.0/README.rst 2018-02-05 14:08:40.000000000 +0100
+++ new/flake8-bugbear-18.8.0/README.rst 2018-08-13 23:47:30.000000000 +0200
@@ -5,6 +5,9 @@
.. image:: https://travis-ci.org/PyCQA/flake8-bugbear.svg?branch=master
:target: https://travis-ci.org/PyCQA/flake8-bugbear
+.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
+ :target: https://github.com/ambv/black
+
A plugin for Flake8 finding likely bugs and design problems in your
program. Contains warnings that don't belong in pyflakes and
pycodestyle::
@@ -20,6 +23,22 @@
3. A fearsome imaginary creature, especially one evoked to frighten
children.
+Installation
+------------
+
+Install from ``pip`` with:
+
+.. code-block:: sh
+
+ pip install flake8-bugbear
+
+It will then automatically be run as part of ``flake8``; you can check it has
+been picked up with:
+
+.. code-block:: sh
+
+ $ flake8 --version
+ 3.5.0 (assertive: 1.0.1, flake8-bugbear: 18.2.0, flake8-comprehensions: 1.4.1, mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 3.7.0 on Darwin
List of warnings
----------------
@@ -186,12 +205,12 @@
If you're still invested in Python 2, there might be a small subset of
deprecated syntax that you'd have to abandon... but you're already doing
-that, right? `six https://pypi.python.org/pypi/six`_ or
-`python-future https://pypi.python.org/pypi/future`_ bridge the gaps.
+that, right? `six https://pypi.org/project/six/`_ or
+`python-future https://pypi.org/project/future/`_ bridge the gaps.
By making the code exclusively Python 3.5+, I'm able to focus on the
quality of the checks and re-use all the nice features of the new
-releases (check out `pathlib `_)
+releases (check out `pathlib https://docs.python.org/3/library/pathlib.html`_)
instead of wasting cycles on Unicode compatibility, etc.
@@ -344,5 +363,5 @@
Glued together by `Łukasz Langa mailto:lukasz@langa.pl`_. Multiple
improvements by `Markus Unterwaditzer mailto:markus@unterwaditzer.net`_,
-`Martijn Pieters mailto:github.com@zopatista.com`_, and
-`Cooper Lees mailto:me@cooperlees.com`_.
+`Martijn Pieters mailto:github.com@zopatista.com`_,
+`Cooper Lees mailto:me@cooperlees.com`_, and `Ryan May mailto:rmay31@gmail.com`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/bugbear.py new/flake8-bugbear-18.8.0/bugbear.py
--- old/flake8-bugbear-18.2.0/bugbear.py 2018-02-05 14:13:34.000000000 +0100
+++ new/flake8-bugbear-18.8.0/bugbear.py 2018-08-14 00:13:47.000000000 +0200
@@ -10,30 +10,27 @@
import pycodestyle
-__version__ = '18.2.0'
+__version__ = "18.8.0"
-LOG = logging.getLogger('flake8.bugbear')
+LOG = logging.getLogger("flake8.bugbear")
@attr.s(hash=False)
class BugBearChecker:
- name = 'flake8-bugbear'
+ name = "flake8-bugbear"
version = __version__
tree = attr.ib(default=None)
- filename = attr.ib(default='(none)')
+ filename = attr.ib(default="(none)")
lines = attr.ib(default=None)
max_line_length = attr.ib(default=79)
- visitor = attr.ib(default=attr.Factory(lambda: BugBearVisitor))
+ visitor = attr.ib(init=False, default=attr.Factory(lambda: BugBearVisitor))
options = attr.ib(default=None)
def run(self):
if not self.tree or not self.lines:
self.load_file()
- visitor = self.visitor(
- filename=self.filename,
- lines=self.lines,
- )
+ visitor = self.visitor(filename=self.filename, lines=self.lines)
visitor.visit(self.tree)
for e in itertools.chain(visitor.errors, self.gen_line_based_checks()):
if pycodestyle.noqa(self.lines[e.lineno - 1]):
@@ -50,11 +47,7 @@
for lineno, line in enumerate(self.lines, start=1):
length = len(line) - 1
if length > 1.1 * self.max_line_length:
- yield B950(
- lineno,
- length,
- vars=(length, self.max_line_length),
- )
+ yield B950(lineno, length, vars=(length, self.max_line_length))
@classmethod
def adapt_error(cls, e):
@@ -94,14 +87,13 @@
As documented in the README, the user is expected to explicitly select
the warnings.
"""
- if code[:2] != 'B9':
+ if code[:2] != "B9":
# Normal warnings are safe for emission.
return True
if self.options is None:
LOG.info(
- "Options not provided to Bugbear, optional warning %s selected.",
- code,
+ "Options not provided to Bugbear, optional warning %s selected.", code
)
return True
@@ -145,75 +137,59 @@
def visit_ExceptHandler(self, node):
if node.type is None:
- self.errors.append(
- B001(node.lineno, node.col_offset)
- )
+ self.errors.append(B001(node.lineno, node.col_offset))
self.generic_visit(node)
def visit_UAdd(self, node):
trailing_nodes = list(map(type, self.node_window[-4:]))
if trailing_nodes == [ast.UnaryOp, ast.UAdd, ast.UnaryOp, ast.UAdd]:
originator = self.node_window[-4]
- self.errors.append(
- B002(originator.lineno, originator.col_offset)
- )
+ self.errors.append(B002(originator.lineno, originator.col_offset))
self.generic_visit(node)
def visit_Call(self, node):
if isinstance(node.func, ast.Attribute):
for bug in (B301, B302, B305):
if node.func.attr in bug.methods:
- call_path = '.'.join(self.compose_call_path(node.func.value))
+ call_path = ".".join(self.compose_call_path(node.func.value))
if call_path not in bug.valid_paths:
- self.errors.append(
- bug(node.lineno, node.col_offset)
- )
+ self.errors.append(bug(node.lineno, node.col_offset))
break
else:
self.check_for_b005(node)
else:
with suppress(AttributeError, IndexError):
if (
- node.func.id in ('getattr', 'hasattr') and
- node.args[1].s == '__call__'
+ node.func.id in ("getattr", "hasattr")
+ and node.args[1].s == "__call__" # noqa: W503
):
- self.errors.append(
- B004(node.lineno, node.col_offset)
- )
+ self.errors.append(B004(node.lineno, node.col_offset))
self.generic_visit(node)
def visit_Attribute(self, node):
call_path = list(self.compose_call_path(node))
- if '.'.join(call_path) == 'sys.maxint':
- self.errors.append(
- B304(node.lineno, node.col_offset)
- )
- elif len(call_path) == 2 and call_path[1] == 'message':
+ if ".".join(call_path) == "sys.maxint":
+ self.errors.append(B304(node.lineno, node.col_offset))
+ elif len(call_path) == 2 and call_path[1] == "message":
name = call_path[0]
for elem in reversed(self.node_stack[:-1]):
if isinstance(elem, ast.ExceptHandler) and elem.name == name:
- self.errors.append(
- B306(node.lineno, node.col_offset)
- )
+ self.errors.append(B306(node.lineno, node.col_offset))
break
def visit_Assign(self, node):
if isinstance(self.node_stack[-2], ast.ClassDef):
# note: by hasattr below we're ignoring starred arguments, slices
# and tuples for simplicity.
- assign_targets = {t.id for t in node.targets if hasattr(t, 'id')}
- if '__metaclass__' in assign_targets:
- self.errors.append(
- B303(node.lineno, node.col_offset)
- )
+ assign_targets = {t.id for t in node.targets if hasattr(t, "id")}
+ if "__metaclass__" in assign_targets:
+ self.errors.append(B303(node.lineno, node.col_offset))
elif len(node.targets) == 1:
t = node.targets[0]
if isinstance(t, ast.Attribute) and isinstance(t.value, ast.Name):
- if (t.value.id, t.attr) == ('os', 'environ'):
- self.errors.append(
- B003(node.lineno, node.col_offset)
- )
+ if (t.value.id, t.attr) == ("os", "environ"):
+ self.errors.append(B003(node.lineno, node.col_offset))
self.generic_visit(node)
def visit_For(self, node):
@@ -249,7 +225,7 @@
if len(node.args) != 1 or not isinstance(node.args[0], ast.Str):
return # used arguments don't match the builtin strip
- call_path = '.'.join(self.compose_call_path(node.func.value))
+ call_path = ".".join(self.compose_call_path(node.func.value))
if call_path in B005.valid_paths:
return # path is exempt
@@ -260,31 +236,23 @@
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(self, node):
- for default in node.args.defaults:
+ for default in node.args.defaults + node.args.kw_defaults:
if isinstance(default, B006.mutable_literals):
- self.errors.append(
- B006(default.lineno, default.col_offset)
- )
+ self.errors.append(B006(default.lineno, default.col_offset))
elif isinstance(default, ast.Call):
- call_path = '.'.join(self.compose_call_path(default.func))
+ 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)
- )
+ self.errors.append(B006(default.lineno, default.col_offset))
else:
- self.errors.append(
- B008(default.lineno, default.col_offset)
- )
+ self.errors.append(B008(default.lineno, default.col_offset))
def check_for_b007(self, node):
targets = NameFinder()
targets.visit(node.target)
- ctrl_names = set(filter(lambda s: not s.startswith('_'), targets.names))
+ ctrl_names = set(filter(lambda s: not s.startswith("_"), targets.names))
body = NameFinder()
for expr in node.body:
body.visit(expr)
@@ -307,9 +275,7 @@
return_node = x
if has_yield and return_node is not None:
- self.errors.append(
- B901(return_node.lineno, return_node.col_offset)
- )
+ self.errors.append(B901(return_node.lineno, return_node.col_offset))
break
xs.extend(ast.iter_child_nodes(x))
@@ -321,35 +287,32 @@
decorators = NameFinder()
decorators.visit(node.decorator_list)
- if 'staticmethod' in decorators.names:
+ if "staticmethod" in decorators.names:
# TODO: maybe warn if the first argument is surprisingly `self` or
# `cls`?
return
- bases = {
- b.id
- for b in self.node_stack[-2].bases if isinstance(b, ast.Name)
- }
- if 'type' in bases:
+ bases = {b.id for b in self.node_stack[-2].bases if isinstance(b, ast.Name)}
+ if "type" in bases:
if (
- 'classmethod' in decorators.names or
- node.name in B902.implicit_classmethods
+ "classmethod" in decorators.names
+ or node.name in B902.implicit_classmethods # noqa: W503
):
expected_first_args = B902.metacls
- kind = 'metaclass class'
+ kind = "metaclass class"
else:
expected_first_args = B902.cls
- kind = 'metaclass instance'
+ kind = "metaclass instance"
else:
if (
- 'classmethod' in decorators.names or
- node.name in B902.implicit_classmethods
+ "classmethod" in decorators.names
+ or node.name in B902.implicit_classmethods # noqa: W503
):
expected_first_args = B902.cls
- kind = 'class'
+ kind = "class"
else:
expected_first_args = B902.self
- kind = 'instance'
+ kind = "instance"
args = node.args.args
vararg = node.args.vararg
@@ -361,47 +324,43 @@
lineno = args[0].lineno
col = args[0].col_offset
elif vararg:
- actual_first_arg = '*' + vararg.arg
+ actual_first_arg = "*" + vararg.arg
lineno = vararg.lineno
col = vararg.col_offset
elif kwarg:
- actual_first_arg = '**' + kwarg.arg
+ actual_first_arg = "**" + kwarg.arg
lineno = kwarg.lineno
col = kwarg.col_offset
elif kwonlyargs:
- actual_first_arg = '*, ' + kwonlyargs[0].arg
+ actual_first_arg = "*, " + kwonlyargs[0].arg
lineno = kwonlyargs[0].lineno
col = kwonlyargs[0].col_offset
else:
- actual_first_arg = '(none)'
+ actual_first_arg = "(none)"
lineno = node.lineno
col = node.col_offset
if actual_first_arg not in expected_first_args:
- if not actual_first_arg.startswith(('(', '*')):
+ if not actual_first_arg.startswith(("(", "*")):
actual_first_arg = repr(actual_first_arg)
self.errors.append(
- B902(
- lineno,
- col,
- vars=(actual_first_arg, kind, expected_first_args[0])
- )
+ B902(lineno, col, vars=(actual_first_arg, kind, expected_first_args[0]))
)
def check_for_b903(self, node):
body = node.body
if (
- body and
- isinstance(body[0], ast.Expr) and
- isinstance(body[0].value, ast.Str)
+ body
+ and isinstance(body[0], ast.Expr) # noqa: W503
+ and isinstance(body[0].value, ast.Str) # noqa: W503
):
# Ignore the docstring
body = body[1:]
if (
- len(body) != 1 or
- not isinstance(body[0], ast.FunctionDef) or
- body[0].name != '__init__'
+ len(body) != 1
+ or not isinstance(body[0], ast.FunctionDef) # noqa: W503
+ or body[0].name != "__init__" # noqa: W503
):
# only classes with *just* an __init__ method are interesting
return
@@ -416,8 +375,7 @@
if not isinstance(stmt.value, ast.Name):
return
- self.errors.append(
- B903(node.lineno, node.col_offset))
+ self.errors.append(B903(node.lineno, node.col_offset))
@attr.s
@@ -427,6 +385,7 @@
After `.visit(node)` is called, `found` is a dict with all name nodes inside,
key is name string, value is the node (useful for location purposes).
"""
+
names = attr.ib(default=attr.Factory(dict))
def visit_Name(self, node):
@@ -442,74 +401,74 @@
return node
-error = namedtuple('error', 'lineno col message type vars')
+error = namedtuple("error", "lineno col message type vars")
Error = partial(partial, error, type=BugBearChecker, vars=())
B001 = Error(
message="B001 Do not use bare `except:`, it also catches unexpected "
- "events like memory errors, interrupts, system exit, and so on. "
- "Prefer `except Exception:`. If you're sure what you're doing, "
- "be explicit and write `except BaseException:`.",
+ "events like memory errors, interrupts, system exit, and so on. "
+ "Prefer `except Exception:`. If you're sure what you're doing, "
+ "be explicit and write `except BaseException:`."
)
B002 = Error(
message="B002 Python does not support the unary prefix increment. Writing "
- "++n is equivalent to +(+(n)), which equals n. You meant n += 1.",
+ "++n is equivalent to +(+(n)), which equals n. You meant n += 1."
)
B003 = Error(
message="B003 Assigning to `os.environ` doesn't clear the environment. "
- "Subprocesses are going to see outdated variables, in disagreement "
- "with the current process. Use `os.environ.clear()` or the `env=` "
- "argument to Popen.",
+ "Subprocesses are going to see outdated variables, in disagreement "
+ "with the current process. Use `os.environ.clear()` or the `env=` "
+ "argument to Popen."
)
B004 = Error(
message="B004 Using `hasattr(x, '__call__')` to test if `x` is callable "
- "is unreliable. If `x` implements custom `__getattr__` or its "
- "`__call__` is itself not callable, you might get misleading "
- "results. Use `callable(x)` for consistent results.",
+ "is unreliable. If `x` implements custom `__getattr__` or its "
+ "`__call__` is itself not callable, you might get misleading "
+ "results. Use `callable(x)` for consistent results."
)
B005 = Error(
message="B005 Using .strip() with multi-character strings is misleading "
- "the reader. It looks like stripping a substring. Move your "
- "character set to a constant if this is deliberate. Use "
- ".replace() or regular expressions to remove string fragments.",
+ "the reader. It looks like stripping a substring. Move your "
+ "character set to a constant if this is deliberate. Use "
+ ".replace() or regular expressions to remove string fragments."
)
-B005.methods = {'lstrip', 'rstrip', 'strip'}
+B005.methods = {"lstrip", "rstrip", "strip"}
B005.valid_paths = {}
B006 = Error(
message="B006 Do not use mutable data structures for argument defaults. "
- "All calls reuse one instance of that data structure, persisting "
- "changes between them.",
+ "All calls reuse one instance of that data structure, persisting "
+ "changes between them."
)
B006.mutable_literals = (ast.Dict, ast.List, ast.Set)
B006.mutable_calls = {
- 'Counter',
- 'OrderedDict',
- 'collections.Counter',
- 'collections.OrderedDict',
- 'collections.defaultdict',
- 'collections.deque',
- 'defaultdict',
- 'deque',
- 'dict',
- 'list',
- 'set',
+ "Counter",
+ "OrderedDict",
+ "collections.Counter",
+ "collections.OrderedDict",
+ "collections.defaultdict",
+ "collections.deque",
+ "defaultdict",
+ "deque",
+ "dict",
+ "list",
+ "set",
}
B007 = Error(
message="B007 Loop control variable {!r} not used within the loop body. "
- "If this is intended, start the name with an underscore.",
+ "If this is intended, start the name with an underscore."
)
B008 = Error(
message="B008 Do not perform calls in argument defaults. The call is "
- "performed only once at function definition time. All calls to your "
- "function will reuse the result of that definition-time call. If "
- "this is intended, assign the function call to a module-level "
- "variable and use that variable as a default value.",
+ "performed only once at function definition time. All calls to your "
+ "function will reuse the result of that definition-time call. If "
+ "this is intended, assign the function call to a module-level "
+ "variable and use that variable as a default value."
)
@@ -517,70 +476,67 @@
# through if they're not.
B301 = Error(
message="B301 Python 3 does not include `.iter*` methods on dictionaries. "
- "Remove the `iter` prefix from the method name. For Python 2 "
- "compatibility, prefer the Python 3 equivalent unless you expect "
- "the size of the container to be large or unbounded. Then use "
- "`six.iter*` or `future.utils.iter*`.",
+ "Remove the `iter` prefix from the method name. For Python 2 "
+ "compatibility, prefer the Python 3 equivalent unless you expect "
+ "the size of the container to be large or unbounded. Then use "
+ "`six.iter*` or `future.utils.iter*`."
)
-B301.methods = {'iterkeys', 'itervalues', 'iteritems', 'iterlists'}
-B301.valid_paths = {'six', 'future.utils', 'builtins'}
+B301.methods = {"iterkeys", "itervalues", "iteritems", "iterlists"}
+B301.valid_paths = {"six", "future.utils", "builtins"}
B302 = Error(
message="B302 Python 3 does not include `.view*` methods on dictionaries. "
- "Remove the `view` prefix from the method name. For Python 2 "
- "compatibility, prefer the Python 3 equivalent unless you expect "
- "the size of the container to be large or unbounded. Then use "
- "`six.view*` or `future.utils.view*`.",
+ "Remove the `view` prefix from the method name. For Python 2 "
+ "compatibility, prefer the Python 3 equivalent unless you expect "
+ "the size of the container to be large or unbounded. Then use "
+ "`six.view*` or `future.utils.view*`."
)
-B302.methods = {'viewkeys', 'viewvalues', 'viewitems', 'viewlists'}
-B302.valid_paths = {'six', 'future.utils', 'builtins'}
+B302.methods = {"viewkeys", "viewvalues", "viewitems", "viewlists"}
+B302.valid_paths = {"six", "future.utils", "builtins"}
B303 = Error(
message="B303 `__metaclass__` does nothing on Python 3. Use "
- "`class MyClass(BaseClass, metaclass=...)`. For Python 2 "
- "compatibility, use `six.add_metaclass`.",
+ "`class MyClass(BaseClass, metaclass=...)`. For Python 2 "
+ "compatibility, use `six.add_metaclass`."
)
-B304 = Error(
- message="B304 `sys.maxint` is not a thing on Python 3. Use `sys.maxsize`.",
-)
+B304 = Error(message="B304 `sys.maxint` is not a thing on Python 3. Use `sys.maxsize`.")
B305 = Error(
message="B305 `.next()` is not a thing on Python 3. Use the `next()` "
- "builtin. For Python 2 compatibility, use `six.next()`.",
+ "builtin. For Python 2 compatibility, use `six.next()`."
)
-B305.methods = {'next'}
-B305.valid_paths = {'six', 'future.utils', 'builtins'}
+B305.methods = {"next"}
+B305.valid_paths = {"six", "future.utils", "builtins"}
B306 = Error(
message="B306 `BaseException.message` has been deprecated as of Python "
- "2.6 and is removed in Python 3. Use `str(e)` to access the "
- "user-readable message. Use `e.args` to access arguments passed "
- "to the exception.",
+ "2.6 and is removed in Python 3. Use `str(e)` to access the "
+ "user-readable message. Use `e.args` to access arguments passed "
+ "to the exception."
)
B901 = Error(
message="B901 Using `yield` together with `return x`. Use native "
- "`async def` coroutines or put a `# noqa` comment on this "
- "line if this was intentional.",
+ "`async def` coroutines or put a `# noqa` comment on this "
+ "line if this was intentional."
)
B902 = Error(
message="B902 Invalid first argument {} used for {} method. Use the "
- "canonical first argument name in methods, i.e. {}."
+ "canonical first argument name in methods, i.e. {}."
)
-B902.implicit_classmethods = {'__new__', '__init_subclass__'}
-B902.self = ['self'] # it's a list because the first is preferred
-B902.cls = ['cls', 'klass'] # ditto.
-B902.metacls = ['metacls', 'metaclass', 'typ'] # ditto.
+B902.implicit_classmethods = {"__new__", "__init_subclass__"}
+B902.self = ["self"] # it's a list because the first is preferred
+B902.cls = ["cls", "klass"] # ditto.
+B902.metacls = ["metacls", "metaclass", "typ"] # ditto.
B903 = Error(
message="B903 Data class should either be immutable or use __slots__ to "
- "save memory. Use collections.namedtuple to generate an immutable "
- "class, or enumerate the attributes in a __slot__ declaration in "
- "the class to leave attributes mutable.")
-
-B950 = Error(
- message='B950 line too long ({} > {} characters)',
+ "save memory. Use collections.namedtuple to generate an immutable "
+ "class, or enumerate the attributes in a __slot__ declaration in "
+ "the class to leave attributes mutable."
)
+B950 = Error(message="B950 line too long ({} > {} characters)")
+
disabled_by_default = ["B901", "B902", "B903", "B950"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/flake8_bugbear.egg-info/PKG-INFO new/flake8-bugbear-18.8.0/flake8_bugbear.egg-info/PKG-INFO
--- old/flake8-bugbear-18.2.0/flake8_bugbear.egg-info/PKG-INFO 2018-02-05 14:13:59.000000000 +0100
+++ new/flake8-bugbear-18.8.0/flake8_bugbear.egg-info/PKG-INFO 2018-08-14 00:14:42.000000000 +0200
@@ -1,12 +1,11 @@
Metadata-Version: 1.2
Name: flake8-bugbear
-Version: 18.2.0
+Version: 18.8.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
Author-email: lukasz@langa.pl
License: MIT
-Description-Content-Type: UNKNOWN
Description: ==============
flake8-bugbear
==============
@@ -14,6 +13,9 @@
.. image:: https://travis-ci.org/PyCQA/flake8-bugbear.svg?branch=master
:target: https://travis-ci.org/PyCQA/flake8-bugbear
+ .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
+ :target: https://github.com/ambv/black
+
A plugin for Flake8 finding likely bugs and design problems in your
program. Contains warnings that don't belong in pyflakes and
pycodestyle::
@@ -29,6 +31,22 @@
3. A fearsome imaginary creature, especially one evoked to frighten
children.
+ Installation
+ ------------
+
+ Install from ``pip`` with:
+
+ .. code-block:: sh
+
+ pip install flake8-bugbear
+
+ It will then automatically be run as part of ``flake8``; you can check it has
+ been picked up with:
+
+ .. code-block:: sh
+
+ $ flake8 --version
+ 3.5.0 (assertive: 1.0.1, flake8-bugbear: 18.2.0, flake8-comprehensions: 1.4.1, mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 3.7.0 on Darwin
List of warnings
----------------
@@ -195,12 +213,12 @@
If you're still invested in Python 2, there might be a small subset of
deprecated syntax that you'd have to abandon... but you're already doing
- that, right? `six https://pypi.python.org/pypi/six`_ or
- `python-future https://pypi.python.org/pypi/future`_ bridge the gaps.
+ that, right? `six https://pypi.org/project/six/`_ or
+ `python-future https://pypi.org/project/future/`_ bridge the gaps.
By making the code exclusively Python 3.5+, I'm able to focus on the
quality of the checks and re-use all the nice features of the new
- releases (check out `pathlib `_)
+ releases (check out `pathlib https://docs.python.org/3/library/pathlib.html`_)
instead of wasting cycles on Unicode compatibility, etc.
@@ -353,8 +371,8 @@
Glued together by `Łukasz Langa mailto:lukasz@langa.pl`_. Multiple
improvements by `Markus Unterwaditzer mailto:markus@unterwaditzer.net`_,
- `Martijn Pieters mailto:github.com@zopatista.com`_, and
- `Cooper Lees mailto:me@cooperlees.com`_.
+ `Martijn Pieters mailto:github.com@zopatista.com`_,
+ `Cooper Lees mailto:me@cooperlees.com`_, and `Ryan May mailto:rmay31@gmail.com`.
Keywords: flake8 bugbear bugs pyflakes pylint linter qa
Platform: UNKNOWN
@@ -368,6 +386,8 @@
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/setup.cfg new/flake8-bugbear-18.8.0/setup.cfg
--- old/flake8-bugbear-18.2.0/setup.cfg 2018-02-05 14:13:59.000000000 +0100
+++ new/flake8-bugbear-18.8.0/setup.cfg 2018-08-14 00:14:42.000000000 +0200
@@ -1,5 +1,5 @@
[bdist_wheel]
-python-tag = py35.py36
+python-tag = py35.py36.py37
[flake8]
ignore = E302, E501
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/setup.py new/flake8-bugbear-18.8.0/setup.py
--- old/flake8-bugbear-18.2.0/setup.py 2018-02-05 14:06:57.000000000 +0100
+++ new/flake8-bugbear-18.8.0/setup.py 2018-08-13 23:47:30.000000000 +0200
@@ -11,52 +11,50 @@
current_dir = os.path.abspath(os.path.dirname(__file__))
-with open(os.path.join(current_dir, 'README.rst'), encoding='utf8') as ld_file:
+with open(os.path.join(current_dir, "README.rst"), encoding="utf8") as ld_file:
long_description = ld_file.read()
-_version_re = re.compile(r'__version__\s+=\s+(?P<version>.*)')
+_version_re = re.compile(r"__version__\s+=\s+(?P<version>.*)")
-with open(os.path.join(current_dir, 'bugbear.py'), 'r') as f:
- version = _version_re.search(f.read()).group('version')
+with open(os.path.join(current_dir, "bugbear.py"), "r") as f:
+ version = _version_re.search(f.read()).group("version")
version = str(ast.literal_eval(version))
setup(
- name='flake8-bugbear',
+ name="flake8-bugbear",
version=version,
description="A plugin for flake8 finding likely bugs and design problems "
- "in your program. Contains warnings that don't belong in "
- "pyflakes and pycodestyle.",
+ "in your program. Contains warnings that don't belong in "
+ "pyflakes and pycodestyle.",
long_description=long_description,
- keywords='flake8 bugbear bugs pyflakes pylint linter qa',
- author='Łukasz Langa',
- author_email='lukasz@langa.pl',
- url='https://github.com/PyCQA/flake8-bugbear',
- license='MIT',
- py_modules=['bugbear'],
+ keywords="flake8 bugbear bugs pyflakes pylint linter qa",
+ author="Łukasz Langa",
+ author_email="lukasz@langa.pl",
+ url="https://github.com/PyCQA/flake8-bugbear",
+ license="MIT",
+ py_modules=["bugbear"],
zip_safe=False,
python_requires=">=3.5",
- install_requires=['flake8 >= 3.0.0', 'attrs'],
- test_suite='tests.test_bugbear',
+ install_requires=["flake8 >= 3.0.0", "attrs"],
+ test_suite="tests.test_bugbear",
classifiers=[
- 'Development Status :: 5 - Production/Stable',
- 'Environment :: Console',
- 'Framework :: Flake8',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: MIT License',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.5',
- 'Programming Language :: Python :: 3.6',
- 'Topic :: Software Development :: Libraries :: Python Modules',
- 'Topic :: Software Development :: Quality Assurance',
+ "Development Status :: 5 - Production/Stable",
+ "Environment :: Console",
+ "Framework :: Flake8",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: MIT License",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.5",
+ "Programming Language :: Python :: 3.6",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3 :: Only",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+ "Topic :: Software Development :: Quality Assurance",
],
- entry_points={
- 'flake8.extension': [
- 'B = bugbear:BugBearChecker',
- ],
- },
+ entry_points={"flake8.extension": ["B = bugbear:BugBearChecker"]},
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/tests/b001.py new/flake8-bugbear-18.8.0/tests/b001.py
--- old/flake8-bugbear-18.2.0/tests/b001.py 2016-04-13 03:28:57.000000000 +0200
+++ new/flake8-bugbear-18.8.0/tests/b001.py 2018-08-13 23:47:30.000000000 +0200
@@ -36,14 +36,14 @@
def func(**kwargs):
try:
- is_debug = kwargs['debug']
+ is_debug = kwargs["debug"]
except:
# should be except KeyError:
return
results = something.call(debug=is_debug)
try:
- results['ok']
+ results["ok"]
except: # noqa
# warning silenced
return
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/tests/b002.py new/flake8-bugbear-18.8.0/tests/b002.py
--- old/flake8-bugbear-18.2.0/tests/b002.py 2016-06-06 23:14:15.000000000 +0200
+++ new/flake8-bugbear-18.8.0/tests/b002.py 2018-08-13 23:47:30.000000000 +0200
@@ -1,19 +1,20 @@
"""
Should emit:
-B002 - on lines 13 and 17
+B002 - on lines 15 and 20
"""
+
def this_is_all_fine(n):
x = n + 1
y = 1 + n
- z = + x + y
+ z = +x + y
return +z
+
def this_is_buggy(n):
x = ++n
return x
+
def this_is_buggy_too(n):
- return (+
- +n
- )
+ return ++n
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/tests/b004.py new/flake8-bugbear-18.8.0/tests/b004.py
--- old/flake8-bugbear-18.2.0/tests/b004.py 2016-11-10 00:59:44.000000000 +0100
+++ new/flake8-bugbear-18.8.0/tests/b004.py 2018-08-13 23:47:30.000000000 +0200
@@ -1,11 +1,12 @@
def this_is_a_bug():
o = object()
- if hasattr(o, '__call__'):
- print('Ooh, callable! Or is it?')
- if getattr(o, '__call__', False):
- print('Ooh, callable! Or is it?')
+ if hasattr(o, "__call__"):
+ print("Ooh, callable! Or is it?")
+ if getattr(o, "__call__", False):
+ print("Ooh, callable! Or is it?")
+
def this_is_fine():
o = object()
if callable(o):
- print('Ooh, this is actually callable.')
+ print("Ooh, this is actually callable.")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/tests/b005.py new/flake8-bugbear-18.8.0/tests/b005.py
--- old/flake8-bugbear-18.2.0/tests/b005.py 2016-11-10 19:36:12.000000000 +0100
+++ new/flake8-bugbear-18.8.0/tests/b005.py 2018-08-13 23:47:30.000000000 +0200
@@ -22,5 +22,5 @@
strip("we") # no warning
other_type().lstrip() # no warning
-other_type().rstrip(['a', 'b', 'c']) # no warning
+other_type().rstrip(["a", "b", "c"]) # no warning
other_type().strip("a", "b") # no warning
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/tests/b006_b008.py new/flake8-bugbear-18.8.0/tests/b006_b008.py
--- old/flake8-bugbear-18.2.0/tests/b006_b008.py 2017-12-12 18:16:54.000000000 +0100
+++ new/flake8-bugbear-18.8.0/tests/b006_b008.py 2018-08-13 23:47:30.000000000 +0200
@@ -22,17 +22,29 @@
def this_too(value=collections.OrderedDict()):
...
+
async def async_this_too(value=collections.OrderedDict()):
...
+
def do_this_instead(value=None):
if value is None:
value = set()
+
def in_fact_all_calls_are_wrong(value=time.time()):
...
-LOGGER= logging.getLogger(__name__)
+
+LOGGER = logging.getLogger(__name__)
+
+
def do_this_instead_of_calls_in_defaults(logger=LOGGER):
# That makes it more obvious that this one value is reused.
...
+
+def kwonlyargs_immutable(*, value=()):
+ ...
+
+def kwonlyargs_mutable(*, value=[]):
+ ...
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/tests/b301_b302_b305.py new/flake8-bugbear-18.8.0/tests/b301_b302_b305.py
--- old/flake8-bugbear-18.2.0/tests/b301_b302_b305.py 2016-06-07 00:28:58.000000000 +0200
+++ new/flake8-bugbear-18.8.0/tests/b301_b302_b305.py 2018-08-13 23:47:30.000000000 +0200
@@ -1,8 +1,8 @@
"""
Should emit:
-B301 - on lines 33-36
-B302 - on lines 37-40
-B305 - on lines 37-40
+B301 - on lines 39-42
+B302 - on lines 43-46
+B305 - on lines 47-48
"""
import builtins # future's builtins really
@@ -11,6 +11,7 @@
from six import iterkeys
from future.utils import itervalues
+
def this_is_okay():
d = {}
iterkeys(d)
@@ -32,6 +33,7 @@
six.next(d)
builtins.next(d)
+
def everything_else_is_wrong():
d = None # note: bugbear is no type checker
d.iterkeys()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/tests/b303_b304.py new/flake8-bugbear-18.8.0/tests/b303_b304.py
--- old/flake8-bugbear-18.2.0/tests/b303_b304.py 2016-06-10 00:21:48.000000000 +0200
+++ new/flake8-bugbear-18.8.0/tests/b303_b304.py 2018-08-13 23:47:30.000000000 +0200
@@ -1,22 +1,26 @@
"""
Should emit:
-B303 - on line 21
-B304 - on line 38
+B303 - on line 25
+B304 - on line 42
"""
import sys
import something_else
+
def this_is_okay():
something_else.maxint
maxint = 3
maxint
+
maxint = 3
+
def this_is_also_okay():
maxint
+
class CustomClassWithBrokenMetaclass:
__metaclass__ = type
maxint = 5 # this is okay
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/tests/b901.py new/flake8-bugbear-18.8.0/tests/b901.py
--- old/flake8-bugbear-18.2.0/tests/b901.py 2016-10-04 22:22:22.000000000 +0200
+++ new/flake8-bugbear-18.8.0/tests/b901.py 2018-08-13 23:47:30.000000000 +0200
@@ -1,8 +1,9 @@
"""
Should emit:
-B901 - on lines 8, 35
+B901 - on lines 9, 36
"""
+
def broken():
if True:
return [1, 2, 3]
@@ -39,6 +40,7 @@
async def not_broken4():
import asyncio
+
await asyncio.sleep(1)
return 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/tests/b903.py new/flake8-bugbear-18.8.0/tests/b903.py
--- old/flake8-bugbear-18.2.0/tests/b903.py 2017-02-28 20:34:58.000000000 +0100
+++ new/flake8-bugbear-18.8.0/tests/b903.py 2018-08-13 23:47:30.000000000 +0200
@@ -8,7 +8,7 @@
class NoWarningsClassAttributes:
- spam = 'ham'
+ spam = "ham"
def __init__(self, foo, bar):
self.foo = foo
@@ -19,12 +19,12 @@
def __init__(self, foo, bar):
self.foo = foo
self.bar = bar
- self.spam = ' - '.join([foo, bar])
+ self.spam = " - ".join([foo, bar])
class NoWarningsMoreStatements:
def __init__(self, foo, bar):
- foo = ' - '.join([foo, bar])
+ foo = " - ".join([foo, bar])
self.foo = foo
self.bar = bar
@@ -37,6 +37,7 @@
class WarningsWithDocstring:
"""A docstring should not be an impediment to a warning"""
+
def __init__(self, foo, bar):
self.foo = foo
self.bar = bar
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-bugbear-18.2.0/tests/test_bugbear.py new/flake8-bugbear-18.8.0/tests/test_bugbear.py
--- old/flake8-bugbear-18.2.0/tests/test_bugbear.py 2017-12-12 18:16:54.000000000 +0100
+++ new/flake8-bugbear-18.8.0/tests/test_bugbear.py 2018-08-13 23:47:30.000000000 +0200
@@ -32,171 +32,170 @@
return [BugBearChecker.adapt_error(e) for e in errors]
def test_b001(self):
- filename = Path(__file__).absolute().parent / 'b001.py'
+ filename = Path(__file__).absolute().parent / "b001.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
- self.assertEqual(
- errors,
- self.errors(B001(8, 0), B001(40, 4)),
- )
+ self.assertEqual(errors, self.errors(B001(8, 0), B001(40, 4)))
def test_b002(self):
- filename = Path(__file__).absolute().parent / 'b002.py'
+ filename = Path(__file__).absolute().parent / "b002.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
- self.assertEqual(
- errors,
- self.errors(B002(13, 8), B002(17, 12)),
- )
+ self.assertEqual(errors, self.errors(B002(15, 8), B002(20, 11)))
def test_b003(self):
- filename = Path(__file__).absolute().parent / 'b003.py'
+ filename = Path(__file__).absolute().parent / "b003.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
- self.assertEqual(
- errors,
- self.errors(B003(10, 0)),
- )
+ self.assertEqual(errors, self.errors(B003(10, 0)))
def test_b004(self):
- filename = Path(__file__).absolute().parent / 'b004.py'
+ filename = Path(__file__).absolute().parent / "b004.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
- self.assertEqual(
- errors,
- self.errors(B004(3, 7), B004(5, 7)),
- )
+ self.assertEqual(errors, self.errors(B004(3, 7), B004(5, 7)))
def test_b005(self):
- filename = Path(__file__).absolute().parent / 'b005.py'
+ filename = Path(__file__).absolute().parent / "b005.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
self.assertEqual(
errors,
- self.errors(B005(4, 0), B005(7, 0), B005(10, 0), B005(13, 0),
- B005(16, 0), B005(19, 0)),
+ self.errors(
+ B005(4, 0),
+ B005(7, 0),
+ B005(10, 0),
+ B005(13, 0),
+ B005(16, 0),
+ B005(19, 0),
+ ),
)
def test_b006_b008(self):
- filename = Path(__file__).absolute().parent / 'b006_b008.py'
+ filename = Path(__file__).absolute().parent / "b006_b008.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
self.assertEqual(
errors,
- self.errors(B006(10, 24), B006(14, 29), B006(18, 19), B006(22, 19),
- B006(25, 31), B008(32, 38)),
+ self.errors(
+ B006(10, 24),
+ B006(14, 29),
+ B006(18, 19),
+ B006(22, 19),
+ B006(26, 31),
+ B008(35, 38),
+ B006(49, 32),
+ ),
)
def test_b007(self):
- filename = Path(__file__).absolute().parent / 'b007.py'
+ filename = Path(__file__).absolute().parent / "b007.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
self.assertEqual(
errors,
- self.errors(B007(6, 4, vars=('i',)), B007(18, 12, vars=('k',)),
- B007(30, 4, vars=('i',)), B007(30, 12, vars=('k',))),
+ self.errors(
+ B007(6, 4, vars=("i",)),
+ B007(18, 12, vars=("k",)),
+ B007(30, 4, vars=("i",)),
+ B007(30, 12, vars=("k",)),
+ ),
)
def test_b301_b302_b305(self):
- filename = Path(__file__).absolute().parent / 'b301_b302_b305.py'
+ filename = Path(__file__).absolute().parent / "b301_b302_b305.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
self.assertEqual(
errors,
- self.errors(B301(37, 4), B301(38, 4), B301(39, 4), B301(40, 4),
- B302(41, 4), B302(42, 4), B302(43, 4), B302(44, 4),
- B305(45, 4), B305(46, 4)),
+ self.errors(
+ B301(39, 4),
+ B301(40, 4),
+ B301(41, 4),
+ B301(42, 4),
+ B302(43, 4),
+ B302(44, 4),
+ B302(45, 4),
+ B302(46, 4),
+ B305(47, 4),
+ B305(48, 4),
+ ),
)
def test_b303_b304(self):
- filename = Path(__file__).absolute().parent / 'b303_b304.py'
+ filename = Path(__file__).absolute().parent / "b303_b304.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
- self.assertEqual(
- errors,
- self.errors(B303(21, 4), B304(38, 4)),
- )
+ self.assertEqual(errors, self.errors(B303(25, 4), B304(42, 4)))
def test_b306(self):
- filename = Path(__file__).absolute().parent / 'b306.py'
+ filename = Path(__file__).absolute().parent / "b306.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
- self.assertEqual(
- errors,
- self.errors(B306(9, 10)),
- )
+ self.assertEqual(errors, self.errors(B306(9, 10)))
def test_b901(self):
- filename = Path(__file__).absolute().parent / 'b901.py'
+ filename = Path(__file__).absolute().parent / "b901.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
- self.assertEqual(
- errors,
- self.errors(B901(8, 8), B901(35, 4))
- )
+ self.assertEqual(errors, self.errors(B901(9, 8), B901(36, 4)))
def test_b902(self):
- filename = Path(__file__).absolute().parent / 'b902.py'
+ filename = Path(__file__).absolute().parent / "b902.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
self.assertEqual(
errors,
self.errors(
- B902(29, 17, vars=("'i_am_special'", 'instance', 'self')),
- B902(32, 30, vars=("'cls'", 'instance', 'self')),
- B902(35, 4, vars=("(none)", 'instance', 'self',)),
- B902(39, 12, vars=("'self'", 'class', 'cls')),
- B902(42, 22, vars=("*args", 'instance', 'self')),
- B902(48, 30, vars=("**kwargs", 'instance', 'self')),
- B902(51, 32, vars=("*, self", 'instance', 'self')),
- B902(54, 44, vars=("*, self", 'instance', 'self')),
- B902(68, 17, vars=("'self'", 'metaclass instance', 'cls')),
- B902(72, 20, vars=("'cls'", 'metaclass class', 'metacls')),
- )
+ B902(29, 17, vars=("'i_am_special'", "instance", "self")),
+ B902(32, 30, vars=("'cls'", "instance", "self")),
+ B902(35, 4, vars=("(none)", "instance", "self")),
+ B902(39, 12, vars=("'self'", "class", "cls")),
+ B902(42, 22, vars=("*args", "instance", "self")),
+ B902(48, 30, vars=("**kwargs", "instance", "self")),
+ B902(51, 32, vars=("*, self", "instance", "self")),
+ B902(54, 44, vars=("*, self", "instance", "self")),
+ B902(68, 17, vars=("'self'", "metaclass instance", "cls")),
+ B902(72, 20, vars=("'cls'", "metaclass class", "metacls")),
+ ),
)
def test_b903(self):
- filename = Path(__file__).absolute().parent / 'b903.py'
+ filename = Path(__file__).absolute().parent / "b903.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
- self.assertEqual(
- errors,
- self.errors(B903(32, 0), B903(38, 0)),
- )
+ self.assertEqual(errors, self.errors(B903(32, 0), B903(38, 0)))
def test_b950(self):
- filename = Path(__file__).absolute().parent / 'b950.py'
+ filename = Path(__file__).absolute().parent / "b950.py"
bbc = BugBearChecker(filename=str(filename))
errors = list(bbc.run())
- self.assertEqual(
- errors,
- self.errors(B950(6, 92, vars=(92, 79))),
- )
+ self.assertEqual(errors, self.errors(B950(6, 92, vars=(92, 79))))
def test_selfclean_bugbear(self):
- filename = Path(__file__).absolute().parent.parent / 'bugbear.py'
+ filename = Path(__file__).absolute().parent.parent / "bugbear.py"
proc = subprocess.run(
- ['flake8', str(filename)],
+ ["flake8", str(filename)],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=60,
)
- self.assertEqual(proc.returncode, 0, proc.stdout.decode('utf8'))
- self.assertEqual(proc.stdout, b'')
- # self.assertEqual(proc.stderr, b'')
+ self.assertEqual(proc.returncode, 0, proc.stdout.decode("utf8"))
+ self.assertEqual(proc.stdout, b"")
+ # self.assertEqual(proc.stderr, b"")
def test_selfclean_test_bugbear(self):
filename = Path(__file__).absolute()
proc = subprocess.run(
- ['flake8', str(filename)],
+ ["flake8", str(filename)],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=60,
)
- self.assertEqual(proc.returncode, 0, proc.stdout.decode('utf8'))
- self.assertEqual(proc.stdout, b'')
+ self.assertEqual(proc.returncode, 0, proc.stdout.decode("utf8"))
+ self.assertEqual(proc.stdout, b"")
# self.assertEqual(proc.stderr, b'')
-if __name__ == '__main__':
+if __name__ == "__main__":
unittest.main()