This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/main by this push:
     new d66fddc  Fix a few problems found by flake8
d66fddc is described below

commit d66fddca30d630da16df73a1bf4c98ade487e00d
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Nov 5 17:01:32 2025 +0000

    Fix a few problems found by flake8
---
 .pre-commit-config.yaml     | 16 ++++++++++++++++
 atr/config.py               |  3 ++-
 atr/db/__init__.py          |  4 ++--
 atr/get/keys.py             |  1 -
 atr/post/keys.py            |  1 -
 atr/shared/distribution.py  |  2 +-
 atr/shared/finish.py        |  8 ++++----
 atr/shared/keys.py          |  1 -
 atr/storage/writers/keys.py |  2 +-
 atr/tasks/message.py        |  3 ++-
 atr/tasks/vote.py           |  3 ++-
 11 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b0d992f..a8d4905 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -65,6 +65,22 @@ repos:
   hooks:
     - id: zizmor
       args: [--min-severity, low]
+# - repo: https://github.com/PyCQA/flake8
+#   rev: 7.3.0
+#   hooks:
+#     - id: flake8
+#       name: Flake8 (cognitive complexity and cohesion)
+#       additional_dependencies:
+#         - flake8-cognitive-complexity
+#         # - flake8-expression-complexity
+#         - flake8-cohesion
+#       args:
+#         - --max-line-length=120
+#         - --select=CCR001,H601
+#         # - --extend-ignore=E203,E251,E266,E402,F841
+#         - --max-cognitive-complexity=20
+#         # - --max-expression-complexity=7
+#         - --cohesion-below=50.0
 - repo: local
   hooks:
     - id: ruff
diff --git a/atr/config.py b/atr/config.py
index 650d645..39eb46a 100644
--- a/atr/config.py
+++ b/atr/config.py
@@ -115,7 +115,8 @@ class Mode(enum.Enum):
 _global_mode: Mode | None = None
 
 
-class ProductionConfig(AppConfig): ...
+class ProductionConfig(AppConfig):
+    pass
 
 
 class ProfilingConfig(AppConfig):
diff --git a/atr/db/__init__.py b/atr/db/__init__.py
index b4d3f01..6d6e3ec 100644
--- a/atr/db/__init__.py
+++ b/atr/db/__init__.py
@@ -20,7 +20,6 @@ from __future__ import annotations
 import contextlib
 import functools
 import os
-from collections.abc import Awaitable, Callable
 from typing import TYPE_CHECKING, Any, Concatenate, Final, TypeGuard, TypeVar
 
 import alembic.command as command
@@ -932,7 +931,8 @@ def session(log_queries: bool | None = None) -> Session:
     #     async with _global_atr_sessionmaker() as session:
     #         yield session
 
-    # from FastAPI documentation: 
https://fastapi-users.github.io/fastapi-users/latest/configuration/databases/sqlalchemy/
+    # from FastAPI documentation:
+    # 
https://fastapi-users.github.io/fastapi-users/latest/configuration/databases/sqlalchemy/
 
     global _global_atr_sessionmaker
     if _global_atr_sessionmaker is None:
diff --git a/atr/get/keys.py b/atr/get/keys.py
index 7f72def..1dc725a 100644
--- a/atr/get/keys.py
+++ b/atr/get/keys.py
@@ -17,7 +17,6 @@
 
 import datetime
 
-import asfquart as asfquart
 import quart
 
 import atr.blueprints.get as get
diff --git a/atr/post/keys.py b/atr/post/keys.py
index 1c13692..0fcad5e 100644
--- a/atr/post/keys.py
+++ b/atr/post/keys.py
@@ -16,7 +16,6 @@
 # under the License.
 
 
-import asfquart as asfquart
 import quart
 
 import atr.blueprints.post as post
diff --git a/atr/shared/distribution.py b/atr/shared/distribution.py
index 67b32fd..2d26fc4 100644
--- a/atr/shared/distribution.py
+++ b/atr/shared/distribution.py
@@ -95,7 +95,7 @@ def html_nav(container: htm.Block, back_url: str, 
back_anchor: str, phase: Phase
     span = htm.Block(htm.span)
 
     def _phase(actual: Phase, expected: Phase) -> None:
-        nonlocal span
+        # nonlocal span
         match expected:
             case "COMPOSE":
                 symbol = "①"
diff --git a/atr/shared/finish.py b/atr/shared/finish.py
index d839dd3..59389e7 100644
--- a/atr/shared/finish.py
+++ b/atr/shared/finish.py
@@ -109,10 +109,10 @@ async def selected(
         msg: str,
     ) -> tuple[web.QuartResponse, int] | web.WerkzeugResponse:
         """Helper to respond with JSON or flash message and redirect."""
-        nonlocal session
-        nonlocal project_name
-        nonlocal version_name
-        nonlocal wants_json
+        # nonlocal session
+        # nonlocal project_name
+        # nonlocal version_name
+        # nonlocal wants_json
 
         ok = http_status < 300
         if wants_json:
diff --git a/atr/shared/keys.py b/atr/shared/keys.py
index 3446b21..b576eca 100644
--- a/atr/shared/keys.py
+++ b/atr/shared/keys.py
@@ -22,7 +22,6 @@ import datetime
 from collections.abc import Awaitable, Callable, Sequence
 
 import aiohttp
-import asfquart as asfquart
 import asfquart.base as base
 import quart
 import werkzeug.datastructures as datastructures
diff --git a/atr/storage/writers/keys.py b/atr/storage/writers/keys.py
index a01877a..66a4c84 100644
--- a/atr/storage/writers/keys.py
+++ b/atr/storage/writers/keys.py
@@ -581,7 +581,7 @@ class CommitteeParticipant(FoundationCommitter):
             log.info(f"Inserted {len(link_inserts)} key links")
 
             def replace_with_linked(key: types.Key) -> types.Key:
-                nonlocal link_inserts
+                # nonlocal link_inserts
                 match key:
                     case types.Key(status=types.KeyStatus.INSERTED):
                         if key.key_model.fingerprint in link_inserts:
diff --git a/atr/tasks/message.py b/atr/tasks/message.py
index f6b4844..75d9b21 100644
--- a/atr/tasks/message.py
+++ b/atr/tasks/message.py
@@ -32,7 +32,8 @@ class Send(schema.Strict):
     in_reply_to: str | None = schema.description("The message ID of the email 
to reply to")
 
 
-class SendError(Exception): ...
+class SendError(Exception):
+    pass
 
 
 @checks.with_model(Send)
diff --git a/atr/tasks/vote.py b/atr/tasks/vote.py
index f93abab..a9f2d61 100644
--- a/atr/tasks/vote.py
+++ b/atr/tasks/vote.py
@@ -40,7 +40,8 @@ class Initiate(schema.Strict):
     body: str = schema.description("Body content for the vote email")
 
 
-class VoteInitiationError(Exception): ...
+class VoteInitiationError(Exception):
+    pass
 
 
 @checks.with_model(Initiate)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to