From cdbc678f26eb10bc6a876c1a4f5cef42ad462504 Mon Sep 17 00:00:00 2001 From: danieleades <33452915+danieleades@users.noreply.github.com> Date: Mon, 15 Nov 2021 15:57:42 +0000 Subject: [PATCH] ci: use flake8-bugbear for linting (#198) --- .pre-commit-config.yaml | 2 ++ poetry/core/masonry/builders/sdist.py | 2 +- poetry/core/utils/helpers.py | 2 +- tests/conftest.py | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 001e33f1d50..891ce39911e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,6 +9,8 @@ repos: rev: 3.9.2 hooks: - id: flake8 + additional_dependencies: + - flake8-bugbear exclude: | (?x)( ^poetry/core/utils/_typing.py$ diff --git a/poetry/core/masonry/builders/sdist.py b/poetry/core/masonry/builders/sdist.py index b653badbca7..1a9ac482ef5 100644 --- a/poetry/core/masonry/builders/sdist.py +++ b/poetry/core/masonry/builders/sdist.py @@ -271,7 +271,7 @@ def find_nearest_pkg(rel_path: str) -> Tuple[str, str]: # Relative to the top-level package return pkg_name, Path(rel_path).as_posix() - for path, dirnames, filenames in os.walk(str(base), topdown=True): + for path, _dirnames, filenames in os.walk(str(base), topdown=True): if os.path.basename(path) == "__pycache__": continue diff --git a/poetry/core/utils/helpers.py b/poetry/core/utils/helpers.py index a6eaa195e66..f58d738f12b 100644 --- a/poetry/core/utils/helpers.py +++ b/poetry/core/utils/helpers.py @@ -96,7 +96,7 @@ def safe_rmtree(path: Union[str, Path]) -> None: def merge_dicts(d1: dict, d2: dict) -> None: - for k, v in d2.items(): + for k in d2.keys(): if k in d1 and isinstance(d1[k], dict) and isinstance(d2[k], Mapping): merge_dicts(d1[k], d2[k]) else: diff --git a/tests/conftest.py b/tests/conftest.py index 25bd23e238f..5ff99b20276 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,7 +24,7 @@ def pytest_configure(config): config.addinivalue_line("markers", "integration: mark integration tests") if not config.option.integration: - setattr(config.option, "markexpr", "not integration") + config.option.markexpr = "not integration" def get_project_from_dir(base_directory): # type: (Path) -> Callable[[str], Path]