Fix linter problems #317

Manually merged
jgroman merged 3 commits from feature/306-3-ruff-linting into develop 2026-06-22 12:55:22 +00:00
Owner
  • Fix ruff check warnings
  • Fix mypy warnings
  • Remove unused imports from requirements
  • Streamline CI jobs

Assisted-by: Claude Code

- Fix ruff check warnings - Fix mypy warnings - Remove unused imports from requirements - Streamline CI jobs Assisted-by: Claude Code
jgroman self-assigned this 2026-06-10 12:33:23 +00:00
Fix linter problems
Some checks failed
Run tests and linters / test (pull_request) Successful in 2m44s
Run tests and linters / lint (pull_request) Failing after 2s
af06f0b3f9
- Fix ruff check warnings
- Fix mypy warnings
- Remove unused imports from requirements

Assisted-by: Claude Code
Fix mypy target in ci.yml
Some checks failed
Run tests and linters / test (pull_request) Successful in 2m45s
Run tests and linters / lint (pull_request) Failing after 2s
1e67024942
Fix mypy problems found by CI
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m43s
Run tests and linters / lint (pull_request) Successful in 2s
d0b7e7513e
Simplify CI setup since all steps should be passing now
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m49s
AI Code Review / ai-review (pull_request_target) Successful in 22s
ff70b4da7a
jgroman changed title from WIP: Fix linter problems to Fix linter problems 2026-06-10 13:24:40 +00:00

AI Code Review

📋 MR Summary

This merge request resolves various ruff and mypy linting warnings, fixes types and unused dependencies, and simplifies the CI workflow.

  • Key Changes:
    • Replaced standalone mock with unittest.mock across tests.
    • Added proper type hints and type: ignore comments to satisfy mypy.
    • Cleaned up unused dependencies from requirements.txt and requirements-development.txt.
    • Refactored CI pipeline to run tests and linters in a single sequential job instead of parallel/dependent jobs.
  • Impact: CI (.forgejo/workflows/ci.yml), Dependencies (requirements.txt, pyproject.toml), Bot Utilities (blockerbugs/util/forgejo_bot.py), Test Suite (testing/)
  • Risk Level: 🟢 Low - The changes consist mostly of non-functional type hints, linting fixes, and test dependency updates with no core logic alterations.

Detailed Code Review

Overall, these are excellent housekeeping changes. Replacing mock with the standard library unittest.mock reduces external dependencies and aligns with modern Python practices. The typing additions make the codebase more robust and readable.

The only minor point is regarding the CI pipeline modifications. By placing the linting steps after the testing step in the same job, linting feedback will be delayed until the tests finish. If the tests fail, the linters will not run at all. Moving linting to run before tests or in a parallel job would ensure faster feedback on code style issues.

📂 File Reviews

📄 `.forgejo/workflows/ci.yml` - Consolidated linting and testing into sequential steps within the same job.
  • Minor [Suggestion]: Linting steps are executed after tests. This means if tests fail, developers won't get linting feedback, and they must wait for tests to finish to see lint results. It is generally best practice to run linters either before tests or in a parallel job to fail fast.
    • Suggestion: Move the ruff and mypy steps to run before the Run tests step.

Summary

  • Overall Assessment: No critical issues identified. Code style, static typing, and dependencies are cleanly updated.
  • Minor Suggestions:
    • Consider moving linting steps before testing in the CI pipeline to provide faster feedback.

🤖 AI Code Review | Generated with ai-code-review | Model: gemini-3.1-pro-preview

⚠️ AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.

## AI Code Review ### 📋 MR Summary This merge request resolves various ruff and mypy linting warnings, fixes types and unused dependencies, and simplifies the CI workflow. - **Key Changes:** - Replaced standalone `mock` with `unittest.mock` across tests. - Added proper type hints and `type: ignore` comments to satisfy `mypy`. - Cleaned up unused dependencies from `requirements.txt` and `requirements-development.txt`. - Refactored CI pipeline to run tests and linters in a single sequential job instead of parallel/dependent jobs. - **Impact:** CI (.forgejo/workflows/ci.yml), Dependencies (requirements.txt, pyproject.toml), Bot Utilities (blockerbugs/util/forgejo_bot.py), Test Suite (testing/) - **Risk Level:** 🟢 Low - The changes consist mostly of non-functional type hints, linting fixes, and test dependency updates with no core logic alterations. ### Detailed Code Review Overall, these are excellent housekeeping changes. Replacing `mock` with the standard library `unittest.mock` reduces external dependencies and aligns with modern Python practices. The typing additions make the codebase more robust and readable. The only minor point is regarding the CI pipeline modifications. By placing the linting steps after the testing step in the same job, linting feedback will be delayed until the tests finish. If the tests fail, the linters will not run at all. Moving linting to run before tests or in a parallel job would ensure faster feedback on code style issues. #### 📂 File Reviews <details> <summary><strong>📄 `.forgejo/workflows/ci.yml`</strong> - Consolidated linting and testing into sequential steps within the same job.</summary> - **Minor** [Suggestion]: Linting steps are executed after tests. This means if tests fail, developers won't get linting feedback, and they must wait for tests to finish to see lint results. It is generally best practice to run linters either before tests or in a parallel job to fail fast. - *Suggestion:* Move the `ruff` and `mypy` steps to run before the `Run tests` step. </details> ### ✅ Summary - **Overall Assessment:** No critical issues identified. Code style, static typing, and dependencies are cleanly updated. - **Minor Suggestions:** - Consider moving linting steps before testing in the CI pipeline to provide faster feedback. --- 🤖 **AI Code Review** | Generated with [ai-code-review](https://gitlab.com/redhat/edge/ci-cd/ai-code-review) | **Model:** `gemini-3.1-pro-preview` ⚠️ *AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.*
Fix AI review finding: do CI lint jobs first
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m54s
5288d081c8
Author
Owner

Ready for review, I guess

Ready for review, I guess
pyproject.toml: config mypy dir to find files
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m52s
bd7e2f5976
forgejo_bot: use a different approach to satisfy mypy
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m48s
7aae7202ff
That keeps the original code structure.
kparal force-pushed feature/306-3-ruff-linting from 7aae7202ff
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m48s
to e5c13b8250
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m44s
2026-06-15 10:54:54 +00:00
Compare
drop unneeded ignores
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m52s
586c3cabc4
define mypy files and drop mypy config from setup.cfg
Some checks failed
Run tests and linters / test (pull_request) Failing after 2m30s
81a5deb1a3
sync deps with setup.py, move pytest to devel reqs
Some checks failed
Run tests and linters / test (pull_request) Failing after 2m25s
a27eda93f4
ci: fix mypy
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m50s
1ab292e68d
ci: ./run lint
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m46s
28b71e9933
continue when there are linting errors (test it)
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m46s
c953c14fa0
fix ci
Some checks failed
Run tests and linters / test (pull_request) Failing after 2m48s
09946a7241
ci: ./run tests
Some checks failed
Run tests and linters / test (pull_request) Failing after 2m27s
6674fde55d
fix typo, drop requirements.txt, fold long lines
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m46s
320b521996
kparal force-pushed feature/306-3-ruff-linting from 320b521996
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m46s
to 3fbc4de037
All checks were successful
Run tests and linters / test (pull_request) Successful in 2m48s
2026-06-15 20:03:05 +00:00
Compare
Owner

I reworked the existing changes into 3 separate commits, and it's OK to be merged, as far as I'm concerned.

@jgroman WDYT?

I reworked the existing changes into 3 separate commits, and it's OK to be merged, as far as I'm concerned. @jgroman WDYT?
kparal requested changes 2026-06-16 09:39:50 +00:00
Dismissed
@ -59,3 +59,1 @@
needs: test
steps:
- name: Evaluate lint results
./run test
Owner

So I wanted to fix #315 with this, but I forgot that this doesn't likely run python3.11, right? I'll need to fix that or go back to the original invocation.

So I wanted to fix #315 with this, but I forgot that this doesn't likely run python3.11, right? I'll need to fix that or go back to the original invocation.
Owner

I was wrong. It's already running in a venv using Python 3.11, so it's using Python 3.11 for pytest as well.

I was wrong. It's already running in a venv using Python 3.11, so it's using Python 3.11 for pytest as well.
kparal marked this conversation as resolved
kparal approved these changes 2026-06-16 09:53:23 +00:00
kparal left a comment

Should be fine now, please review as well

Should be fine now, please review as well
Author
Owner

Cannot add myself to reviewers group but LGTM.

Cannot add myself to reviewers group but LGTM. ✅
jgroman manually merged commit 3fbc4de037 into develop 2026-06-22 12:55:22 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
quality/blockerbugs!317
No description provided.