From 40f4ab20ba0903abd3d5c6844fc626eb264b9a6a Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Sat, 17 Apr 2021 14:59:35 -0700 Subject: [PATCH] chore: fix F841 errors reported by flake8 Local variable name is assigned to but never used https://www.flake8rules.com/rules/F841.html --- .github/workflows/lint.yml | 17 +++++++---------- gitlab/cli.py | 1 - gitlab/tests/objects/test_appearance.py | 2 +- gitlab/tests/test_base.py | 2 +- gitlab/v4/objects/todos.py | 2 +- tox.ini | 6 +++++- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4c11810da..556a186f0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,14 +12,6 @@ env: PY_COLORS: 1 jobs: - black: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - uses: psf/black@stable - with: - black_args: ". --check" commitlint: runs-on: ubuntu-latest steps: @@ -28,10 +20,15 @@ jobs: fetch-depth: 0 - uses: wagoid/commitlint-github-action@v3 - mypy: + linters: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - run: pip install --upgrade tox - - run: tox -e mypy + - name: Run black code formatter (https://black.readthedocs.io/en/stable/) + run: tox -e black -- --check + - name: Run flake8 (https://flake8.pycqa.org/en/latest/) + run: tox -e pep8 + - name: Run mypy static typing checker (http://mypy-lang.org/) + run: tox -e mypy diff --git a/gitlab/cli.py b/gitlab/cli.py index ce50406c6..0a97ed7cf 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -162,7 +162,6 @@ def docs() -> argparse.ArgumentParser: if "sphinx" not in sys.modules: sys.exit("Docs parser is only intended for build_sphinx") - parser = _get_base_parser(add_help=False) # NOTE: We must delay import of gitlab.v4.cli until now or # otherwise it will cause circular import errors import gitlab.v4.cli diff --git a/gitlab/tests/objects/test_appearance.py b/gitlab/tests/objects/test_appearance.py index 7c5230146..43ea57440 100644 --- a/gitlab/tests/objects/test_appearance.py +++ b/gitlab/tests/objects/test_appearance.py @@ -63,4 +63,4 @@ def test_get_update_appearance(gl, resp_application_appearance): def test_update_appearance(gl, resp_application_appearance): - resp = gl.appearance.update(title=new_title, description=new_description) + gl.appearance.update(title=new_title, description=new_description) diff --git a/gitlab/tests/test_base.py b/gitlab/tests/test_base.py index 2fa4b1ac5..aac9af683 100644 --- a/gitlab/tests/test_base.py +++ b/gitlab/tests/test_base.py @@ -92,7 +92,7 @@ def test_picklability(self, fake_manager): assert isinstance(unpickled, FakeObject) assert hasattr(unpickled, "_module") assert unpickled._module == original_obj_module - pickled2 = pickle.dumps(unpickled) + pickle.dumps(unpickled) def test_attrs(self, fake_manager): obj = FakeObject(fake_manager, {"foo": "bar"}) diff --git a/gitlab/v4/objects/todos.py b/gitlab/v4/objects/todos.py index 33ad7ee23..7dc7a51ec 100644 --- a/gitlab/v4/objects/todos.py +++ b/gitlab/v4/objects/todos.py @@ -48,4 +48,4 @@ def mark_all_as_done(self, **kwargs): Returns: int: The number of todos maked done """ - result = self.gitlab.http_post("/todos/mark_as_done", **kwargs) + self.gitlab.http_post("/todos/mark_as_done", **kwargs) diff --git a/tox.ini b/tox.ini index c521a3bb5..7d3859204 100644 --- a/tox.ini +++ b/tox.ini @@ -52,7 +52,11 @@ commands = {posargs} [flake8] exclude = .git,.venv,.tox,dist,doc,*egg,build, max-line-length = 88 -ignore = E501,H501,H803,W503 +# We ignore the following because we use black to handle code-formatting +# E203: Whitespace before ':' +# E501: Line too long +# W503: Line break occurred before a binary operator +ignore = E203,E501,W503 per-file-ignores = gitlab/v4/objects/__init__.py:F401,F403