Enable flake8-bugbear linting and fix raised issues

Signed-off-by: Alfred Wingate <parona@protonmail.com>
This commit is contained in:
Alfred Wingate 2023-11-16 06:25:40 +02:00
parent 49f1fbbad1
commit 443b5f62fd
No known key found for this signature in database
GPG Key ID: A12750536B5E7010
4 changed files with 5 additions and 6 deletions

View File

@ -283,8 +283,8 @@ def parse_args():
# apply getopts to command line, show partial help on failure # apply getopts to command line, show partial help on failure
try: try:
opts, args = getopt.getopt(sys.argv[1:], short_opts, long_opts) opts, args = getopt.getopt(sys.argv[1:], short_opts, long_opts)
except getopt.GetoptError: except getopt.GetoptError as exc:
raise ParseArgsError(opts_mode + "-options") raise ParseArgsError(opts_mode + "-options") from exc
# set options accordingly # set options accordingly
option_switch(opts) option_switch(opts)

View File

@ -42,4 +42,4 @@ src_paths = ["bin/euscan", "src/euscan/"]
extend-include = ["bin/euscan", "bin/euscan_patch_metadata"] extend-include = ["bin/euscan", "bin/euscan_patch_metadata"]
[tool.ruff.lint] [tool.ruff.lint]
extend-select = ["E", "N", "UP", "W"] extend-select = ["B", "E", "N", "UP", "W"]

View File

@ -13,7 +13,7 @@ from euscan import CONFIG, output
handlers = {"package": [], "url": [], "all": {}} handlers = {"package": [], "url": [], "all": {}}
# autoimport all modules in this directory and append them to handlers list # autoimport all modules in this directory and append them to handlers list
for loader, module_name, is_pkg in pkgutil.walk_packages(__path__): for loader, module_name, _is_pkg in pkgutil.walk_packages(__path__):
module = loader.find_spec(module_name).loader.load_module(module_name) module = loader.find_spec(module_name).loader.load_module(module_name)
if not hasattr(module, "HANDLER_NAME"): if not hasattr(module, "HANDLER_NAME"):
continue continue

View File

@ -92,7 +92,6 @@ def version_blacklisted(cp, version):
for bv in BLACKLIST_VERSIONS: for bv in BLACKLIST_VERSIONS:
if dep.match_from_list(bv, [cpv]): if dep.match_from_list(bv, [cpv]):
rule = bv rule = bv
None
if rule: if rule:
euscan.output.einfo(f"{cpv} is blacklisted by rule {rule}") euscan.output.einfo(f"{cpv} is blacklisted by rule {rule}")
@ -223,7 +222,7 @@ def gen_versions(components, level):
for i in range(n, n - level, -1): for i in range(n, n - level, -1):
increment_version(components, i - 1) increment_version(components, i - 1)
for j in range(depth): for _j in range(depth):
versions.append(list(components)) versions.append(list(components))
increment_version(components, i - 1) increment_version(components, i - 1)