Skip to content

feat tidy formatting, add pre-commit CI, and fix tests- Reformat dict comprehension and log.error lines in routes.py a more compact, consistent style and to remove spurious line breaks that caused uneven diff noise. - #23

Merged
alain-sv merged 1 commit into
developfrom
improve-cicd
Apr 13, 2026

Conversation

@alain-sv

Copy link
Copy Markdown
Contributor

Add a pre-commit job to the Git Actions workflow to run pre-commit
hooks (with Python3.13, uv, and dependency install) and skip
commit-message hooks in CI. This enforces repository coding standards
before.

  • Restore/test steps: unify dependency installation and replace the
    previous combined lint/test step with a dedicated pytest step to
    simplify CI behavior.
  • Normalize license header duplication and list formatting in tests to
    inconsistent spacing and bracket placement that could trigger style.
    Minor whitespace/format adjustments files to improve consistency and
    reduce unnecessary diffs.

Reason:

  • Maintain consistent code style and reduce noisy diffs.
  • Enforce precommit checks in CI to catch issues early.
    Simplify CI job steps be and robust for test runs.

… comprehension and log.error lines in routes.py a more compact, consistent style and to remove spurious line breaks that caused uneven diff noise.

Add a pre-commit job to the Git Actions workflow to run pre-commit
 hooks (with Python3.13, uv, and dependency install) and skip
 commit-message hooks in CI. This enforces repository coding standards
 before.
- Restore/test steps: unify dependency installation and replace the
  previous combined lint/test step with a dedicated pytest step to
  simplify CI behavior.
- Normalize license header duplication and list formatting in tests to
  inconsistent spacing and bracket placement that could trigger style.
 Minor whitespace/format adjustments files to improve consistency and
 reduce unnecessary diffs.

Reason:
- Maintain consistent code style and reduce noisy diffs.
- Enforce precommit checks in CI to catch issues early.
 Simplify CI job steps be and robust for test runs.
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Add pre-commit CI job and refactor code formatting

✨ Enhancement 🧪 Tests

Grey Divider

Walkthroughs

Description
• Add pre-commit CI job to GitHub Actions workflow
• Refactor dict comprehension and log.error formatting in routes.py
• Simplify CI workflow by removing separate lint step
• Fix duplicate license header in test file
Diagram
flowchart LR
  A["GitHub Actions Workflow"] -->|"Add pre-commit job"| B["Pre-commit Hooks"]
  A -->|"Simplify build job"| C["Remove ruff lint step"]
  D["routes.py"] -->|"Compact formatting"| E["Dict comprehension & log.error"]
  F["test_routes_case_update.py"] -->|"Fix duplicate header"| G["Single license header"]
Loading

Grey Divider

File Changes

1. .github/workflows/python-package.yml ⚙️ Configuration changes +21/-9

Add pre-commit CI job and simplify build workflow

• Add new pre-commit job that runs pre-commit hooks with Python 3.13 and uv
• Skip commit-message hooks in CI environment via SKIP variable
• Remove separate ruff linting step from build job
• Simplify dependency installation command in build job

.github/workflows/python-package.yml


2. src/supervaizer/routes.py Formatting +2/-6

Compact dict comprehension and log.error formatting

• Compact dict comprehension from multi-line to single-line format
• Reformat log.error call from multi-line to single-line format
• Improve code consistency and reduce unnecessary line breaks

src/supervaizer/routes.py


3. tests/test_routes_case_update.py Formatting +9/-3

Fix duplicate license header and reformat list call

• Remove duplicate license header at file start
• Reformat ParametersSetup.from_list call to multi-line bracket style
• Maintain single copyright header for consistency

tests/test_routes_case_update.py


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Apr 13, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2)   📘 Rule violations (1)   📎 Requirement gaps (0)
🐞\ ☼ Reliability (1) ⚙ Maintainability (1)
📘\ ✧ Quality (1)

Grey Divider


Action required

1. CI missing black --check 📘
Description
The updated GitHub Actions workflow runs pre-commit and pytest but does not run Black in check mode,
so Black formatting is not enforced in CI. The project configuration also lacks a [tool.black]
section, so Black cannot be applied consistently using project settings.
Code

.github/workflows/python-package.yml[R14-34]

+  pre-commit:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - uses: actions/setup-python@v5
+        with:
+          python-version: "3.13"
+      - uses: astral-sh/setup-uv@v6
+        with:
+          version: "latest"
+      - name: Install dependencies
+        run: uv sync --extra dev
+      - name: Run pre-commit hooks
+        run: uv run pre-commit run --all-files
+        env:
+          # Commit-message hooks check `git log` HEAD — not meaningful in CI
+          SKIP: conventional-gitmoji,commitizen
+
  build:
    runs-on: ubuntu-latest
Evidence
PR Compliance ID 116966 requires Black formatting to be enforced using project configuration and
checked in CI. The workflow shown runs pre-commit and pytest only (no black --check step), and
pyproject.toml includes Ruff/Mypy configuration but no [tool.black] section to define Black
settings.

Rule 116966: Enforce Black formatting with project configuration
.github/workflows/python-package.yml[14-53]
pyproject.toml[92-127]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The CI workflow does not enforce Black formatting, and the project lacks a `[tool.black]` configuration section.

## Issue Context
Compliance requires Black to be configured via project configuration and executed in CI check mode.

## Fix Focus Areas
- .github/workflows/python-package.yml[14-53]
- pyproject.toml[92-127]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. CI Python version mismatch 🐞
Description
The GitHub Actions build matrix runs Python 3.10/3.11 even though the project declares
requires-python >=3.12, so installs/tests are expected to fail for those jobs. This makes CI
unreliable and can block merges.
Code

↗ .github/workflows/python-package.yml

        with:
Evidence
The workflow matrix includes Python 3.10 and 3.11, but the project metadata requires Python 3.12+,
so running uv sync/tests under 3.10/3.11 is inconsistent with the package requirement.

.github/workflows/python-package.yml[32-53]
pyproject.toml[1-6]
.python-version[1-1]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
CI runs tests on Python versions (3.10/3.11) that are outside the project’s declared `requires-python (>=3.12)`, which can cause dependency installation and test jobs to fail.

### Issue Context
The workflow uses a Python version matrix for the `build` job, while `pyproject.toml` constrains supported Python.

### Fix Focus Areas
- .github/workflows/python-package.yml[35-39]
- pyproject.toml[1-6]

### Expected fix
Either:
1) Remove 3.10/3.11 from the workflow matrix (keep 3.12/3.13), **or**
2) If 3.10/3.11 must be supported, lower `requires-python` and ensure dependencies/tests truly work on those versions.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Duplicate license header 🐞
Description
tests/test_routes_case_update.py now contains two consecutive MPL header blocks, which is
unintentional and reduces maintainability/readability. One of the duplicated headers should be
removed to keep a single canonical header.
Code

tests/test_routes_case_update.py[R1-9]

+# Copyright (c) 2024-2025 Alain Prasquier - Supervaize.com. All rights reserved.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
+# If a copy of the MPL was not distributed with this file, you can obtain one at
+# https://mozilla.org/MPL/2.0/.
+
# Copyright (c) 2024-2025 Alain Prasquier - Supervaize.com. All rights reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
Evidence
The test file shows two full license headers back-to-back at the top. The repository’s pre-commit
configuration includes an insert-license hook pointing to .github/LICENSE.txt, which matches the
newly inserted header; the older header remains below it.

tests/test_routes_case_update.py[1-12]
.github/LICENSE.txt[1-5]
.pre-commit-config.yaml[35-46]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
A duplicated MPL license header was introduced at the top of `tests/test_routes_case_update.py` (two headers back-to-back). This should be reduced to a single canonical header.

### Issue Context
The repo uses a pre-commit `insert-license` hook configured with `.github/LICENSE.txt`, which matches the newly inserted header.

### Fix Focus Areas
- tests/test_routes_case_update.py[1-12]
- .github/LICENSE.txt[1-5]

### Expected fix
Keep exactly one header block (preferably matching `.github/LICENSE.txt`) and delete the duplicate block beneath it.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@alain-sv
alain-sv merged commit bf19c4a into develop Apr 13, 2026
6 checks passed
Comment on lines +14 to 34
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- uses: astral-sh/setup-uv@v6
with:
version: "latest"
- name: Install dependencies
run: uv sync --extra dev
- name: Run pre-commit hooks
run: uv run pre-commit run --all-files
env:
# Commit-message hooks check `git log` HEAD — not meaningful in CI
SKIP: conventional-gitmoji,commitizen

build:
runs-on: ubuntu-latest

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Ci missing black --check 📘 Rule violation ✧ Quality

The updated GitHub Actions workflow runs pre-commit and pytest but does not run Black in check mode,
so Black formatting is not enforced in CI. The project configuration also lacks a [tool.black]
section, so Black cannot be applied consistently using project settings.
Agent Prompt
## Issue description
The CI workflow does not enforce Black formatting, and the project lacks a `[tool.black]` configuration section.

## Issue Context
Compliance requires Black to be configured via project configuration and executed in CI check mode.

## Fix Focus Areas
- .github/workflows/python-package.yml[14-53]
- pyproject.toml[92-127]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@alain-sv
alain-sv deleted the improve-cicd branch May 13, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant