Adapt to ruff 0.16.0 - #53
Conversation
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Assisted-by: Cursor 3.12.29 Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Assisted-by: Cursor 3.12.29 Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Assisted-By: Cursor 3.12.29 Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
* Treat `import elnbuildsync` as first-party * Ignore `except Exception` violations. We need to ensure that the service never crashes. Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
The status page will now only be read and the template applied during service startup. Once upon a time, it needed to be applied at each request, but when we switched to using the JSON feed to populate the results, that stopped being the case. Now the only templatized variable is the ELNBuildSync version, and that won't change throughout the runtime, so we can just apply the template once at startup and save it. Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
|
Warning Review limit reached
Next review available in: 43 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. 📝 WalkthroughWalkthroughThe change installs Twisted’s asyncio reactor during package startup, centralizes asynchronous YAML loading, caches rendered status HTML, modernizes type annotations and runtime helpers, adjusts exception handling, and updates lint configuration and configuration-loading tests. ChangesRuntime modernization
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Also drop the executable portion of web.py, which hasn't actually supported it for a long time. Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
The ruff and flake8 commands differ in their opinions around E203 and E402, so we'll pick a winner (ruff) and tell flake8 to ignore it. Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@elnbuildsync/__init__.py`:
- Around line 19-30: Centralize asyncio reactor bootstrap in
elnbuildsync/__init__.py: install it when no reactor exists, ignore only an
already-installed AsyncioSelectorReactor, and propagate or fail for any other
reactor type. In elnbuildsync/daemon.py, remove the duplicate installation or
make its direct-import bootstrap a no-op when the shared initialization has
already completed, while preserving correct setup for direct daemon imports.
Apply these changes in elnbuildsync/__init__.py lines 19-30 and
elnbuildsync/daemon.py lines 19-35.
In `@elnbuildsync/db_models.py`:
- Around line 94-97: Update DBTagMessage.slice_id and DBTagMessage.slice
annotations to Optional types, matching the nullable ForeignKey and allowing tag
messages without a reachable RebuildBatchSlice association; preserve the
existing mapped_column and relationship configuration.
In `@elnbuildsync/listener.py`:
- Around line 119-120: Update PendingNVRTags to support direct membership by
adding a __contains__ implementation that checks self._data, or change the
membership test in the listener’s tag-handling branch to use
pending_nvr_tags.keys(). Preserve the existing awaited-tag handling behavior.
In `@pyproject.toml`:
- Around line 48-53: Update the Ruff configuration near [tool.ruff.lint] to add
a per-file ignore for elnbuildsync/__init__.py covering E402, preserving the
existing .flake8 suppression and allowing the intentional post-bootstrap imports
to pass ruff check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0ddec43d-aeac-4485-98ee-3e2de121ba94
📒 Files selected for processing (29)
.flake8.github/workflows/ci.ymlelnbuildsync/__init__.pyelnbuildsync/auth.pyelnbuildsync/batching.pyelnbuildsync/cleanup.pyelnbuildsync/config/__init__.pyelnbuildsync/config/dynamic.pyelnbuildsync/config/static.pyelnbuildsync/daemon.pyelnbuildsync/db_models.pyelnbuildsync/decorators.pyelnbuildsync/email.pyelnbuildsync/kojihelpers/__init__.pyelnbuildsync/kojihelpers/builds.pyelnbuildsync/kojihelpers/connection.pyelnbuildsync/kojihelpers/tags.pyelnbuildsync/listener.pyelnbuildsync/rebuildattempt.pyelnbuildsync/rebuildbatch.pyelnbuildsync/rebuildbatchslice.pyelnbuildsync/state.pyelnbuildsync/status.pyelnbuildsync/tagmessage.pyelnbuildsync/utils.pyelnbuildsync/web.pypyproject.tomltests/smoketest.pytests/test_parse_config.py
💤 Files with no reviewable changes (2)
- tests/smoketest.py
- elnbuildsync/kojihelpers/init.py
All launches of EBS now go through the entrypoint rather than calling daemon.py directly, so we can keep the reactor setup in one place. Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
elnbuildsync/daemon.py (1)
1-1: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUpdate the README to match the removed direct CLI path.
daemon.pyno longer has a shebang orif __name__ == "__main__": main(), but the README still describes it as a CLI entry and showselnbuildsync/daemon.pyas start/feedback documentation. Either restore that direct execution path or update the remaining daemon.py/README references to point at the installedelnbuildsyncpackage entrypoint.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@elnbuildsync/daemon.py` at line 1, Update the README and any remaining daemon.py references to use the installed elnbuildsync package entrypoint instead of presenting daemon.py as a directly executable CLI; keep documentation examples and start/feedback guidance consistent with the current entrypoint.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@elnbuildsync/daemon.py`:
- Line 1: Update the README and any remaining daemon.py references to use the
installed elnbuildsync package entrypoint instead of presenting daemon.py as a
directly executable CLI; keep documentation examples and start/feedback guidance
consistent with the current entrypoint.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6c210110-fa18-4597-94a5-2fc54fd30e82
📒 Files selected for processing (5)
elnbuildsync/__init__.pyelnbuildsync/daemon.pyelnbuildsync/db_models.pyelnbuildsync/state.pypyproject.toml
🚧 Files skipped from review as they are similar to previous changes (3)
- elnbuildsync/state.py
- elnbuildsync/init.py
- elnbuildsync/db_models.py
Use the elnbuildsync script instead. Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
CI: display 'ruff check' output inline
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
ruff: Apply 'safe' fixes
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
ruff: Clean up TRY401 issues
Assisted-by: Cursor 3.12.29
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
ruff: Clean up SIM117 issues
Assisted-by: Cursor 3.12.29
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
ruff: Clean up SIM115 issues
Assisted-By: Cursor 3.12.29
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
ruff: Configuration fixes
import elnbuildsyncas first-partyexcept Exceptionviolations. We need to ensure that theservice never crashes.
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
Remove shebangs
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
C408: Replace dict() and list() with literals
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
Don't block reading the status page template
The status page will now only be read and the template applied during
service startup. Once upon a time, it needed to be applied at each
request, but when we switched to using the JSON feed to populate the
results, that stopped being the case. Now the only templatized variable
is the ELNBuildSync version, and that won't change throughout the
runtime, so we can just apply the template once at startup and save it.
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
SIM118: Use more efficient key lookup
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
FA102: Import annotations
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
Drop redundant assignment
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
I001: Missing empty line
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
UP037: Drop quotes on types thanks to future.annotaions
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
C403: Use set comprehension
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
UP045: Replace Optional[] with |
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
SIM103: Simpler return
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
UP028: Simpler yield loop
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
SIM401: Simpler get()
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
B006: Use cleaner default
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
RUF012: Explicitly annotate that these are class variables
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
ASYNC230: Use deferToThread() for open() operations
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
Read the template file asynchronously
Also drop the executable portion of web.py, which hasn't actually
supported it for a long time.
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
Avoid circular dependencies
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
Fix flake8 issues
The ruff and flake8 commands differ in their opinions around E203 and
E402, so we'll pick a winner (ruff) and tell flake8 to ignore it.
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
Simplify asyncio reactor setup
All launches of EBS now go through the entrypoint rather than calling
daemon.py directly, so we can keep the reactor setup in one place.
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
DB: Match nullable and optional keys
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
PendingNVRTags: implement contains()
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
ruff: Ignore E402 in init.py
Signed-off-by: Stephen Gallagher sgallagh@redhat.com