From 443b5f62fd261eeda660802d6a90e2e9b4a59901 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Thu, 16 Nov 2023 06:25:40 +0200 Subject: [PATCH] Enable flake8-bugbear linting and fix raised issues Signed-off-by: Alfred Wingate --- bin/euscan | 4 ++-- pyproject.toml | 2 +- src/euscan/handlers/__init__.py | 2 +- src/euscan/helpers.py | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/euscan b/bin/euscan index a78b9b2..8e4bf76 100755 --- a/bin/euscan +++ b/bin/euscan @@ -283,8 +283,8 @@ def parse_args(): # apply getopts to command line, show partial help on failure try: opts, args = getopt.getopt(sys.argv[1:], short_opts, long_opts) - except getopt.GetoptError: - raise ParseArgsError(opts_mode + "-options") + except getopt.GetoptError as exc: + raise ParseArgsError(opts_mode + "-options") from exc # set options accordingly option_switch(opts) diff --git a/pyproject.toml b/pyproject.toml index e03de1b..569e63e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,4 +42,4 @@ src_paths = ["bin/euscan", "src/euscan/"] extend-include = ["bin/euscan", "bin/euscan_patch_metadata"] [tool.ruff.lint] -extend-select = ["E", "N", "UP", "W"] +extend-select = ["B", "E", "N", "UP", "W"] diff --git a/src/euscan/handlers/__init__.py b/src/euscan/handlers/__init__.py index e7a40fe..0c969d0 100644 --- a/src/euscan/handlers/__init__.py +++ b/src/euscan/handlers/__init__.py @@ -13,7 +13,7 @@ from euscan import CONFIG, output handlers = {"package": [], "url": [], "all": {}} # 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) if not hasattr(module, "HANDLER_NAME"): continue diff --git a/src/euscan/helpers.py b/src/euscan/helpers.py index b5cc791..dc0b6c8 100644 --- a/src/euscan/helpers.py +++ b/src/euscan/helpers.py @@ -92,7 +92,6 @@ def version_blacklisted(cp, version): for bv in BLACKLIST_VERSIONS: if dep.match_from_list(bv, [cpv]): rule = bv - None if 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): increment_version(components, i - 1) - for j in range(depth): + for _j in range(depth): versions.append(list(components)) increment_version(components, i - 1)