From: Jeremy Stanley Date: Sat, 30 Mar 2019 19:09:01 +0000 (+0000) Subject: Test with the bugbear plugin for flake8 X-Git-Tag: 0.0.1~29 X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=commitdiff_plain;h=38aff5fc519f55a8b15a7602f34167bcfea3d7f6;ds=sidebyside Test with the bugbear plugin for flake8 Add the bugbear plugin to the flake8 tox testenv, and mark as private a couple of loop control variables it identified (B007). --- diff --git a/mudpy/misc.py b/mudpy/misc.py index 7c013a8..76f4099 100644 --- a/mudpy/misc.py +++ b/mudpy/misc.py @@ -1191,7 +1191,7 @@ def weighted_choice(data): # create the expanded list of keys for key in data.keys(): - for count in range(data[key]): + for _count in range(data[key]): expanded.append(key) # return one at random @@ -1242,7 +1242,7 @@ def random_name(): name = "" # create a name of random length from the syllables - for syllable in range(random.randrange(2, 6)): + for _syllable in range(random.randrange(2, 6)): name += weighted_choice(syllables) # strip any leading quotemark, capitalize and return the name diff --git a/tox.ini b/tox.ini index de62e4e..7a73d73 100644 --- a/tox.ini +++ b/tox.ini @@ -39,7 +39,9 @@ commands = sphinx-build -W -d doc/build/doctrees -b html doc/source/ doc/build/html [testenv:flake8] -deps = flake8 +deps = + flake8 + flake8-bugbear commands = flake8 {posargs} [testenv:selftest_config]