Enable preview lint checks of ruff
See [1]: preview rules are sometimes interesting rules, but they are not enabled and ruff community collects opinions before deciding whether a rule is worth eing enabled by default.
And there are some useful rules, I'd like to start enabling them in smaller groups, to make review easier. Starting with this patch and already enabled rules.
[1] https://docs.astral.sh/ruff/preview/#preview
Pull Request Checklist
- [ ] implement the feature
- [ ] write the documentation
- [ ] extend the test coverage
- [ ] update the specification
- [ ] adjust plugin docstring
- [ ] modify the json schema
- [ ] mention the version
- [ ] include a release note
I'm usually using --preview locally, but not sure about enabling it config, even manually, as it might be hard to maintain. The preview rules can often be moved to other rules, or be dropped completely.
That said, given the cadence of ruff releases, perhaps we should focus on some autoupdate solution. One could be move to https://github.com/pre-commit/action ?
Is there a way to only show preview violation as a warning, not failing the check?
I'm usually using --preview locally, but not sure about enabling it config, even manually, as it might be hard to maintain. The preview rules can often be moved to other rules, or be dropped completely. That said, given the cadence of ruff releases, perhaps we should focus on some autoupdate solution. One could be move to https://github.com/pre-commit/action ?
Is there a way to only show preview violation as a warning, not failing the check?
No idea.
Enabling the preview rules showed very few violations, and TBH, since February, I forgot why I wanted to enable this, what were the issues I discovered there's a check for which is preview-only. So it's a kind of sad story now. Anyway, maybe my memory will return, and it can just as well rot in PR queue, marking it as ready for review and moving on.
@coderabbitai full review
✅ Actions performed
Full review triggered.
[!WARNING]
Rate limit exceeded
@happz has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 29 minutes and 35 seconds before requesting another review.
⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.
📥 Commits
Reviewing files that changed from the base of the PR and between 702717662a91ea535384620e50971d7287cdda0d and 1b251adcd47efc88c7955a1ab52e8efe45b74f4f.
📒 Files selected for processing (5)
pyproject.toml(1 hunks)tmt/options.py(2 hunks)tmt/steps/provision/mrack.py(2 hunks)tmt/steps/report/junit.py(2 hunks)tmt/steps/report/reportportal.py(1 hunks)
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.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
‼️ IMPORTANT Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai auto-generate unit teststo generate unit tests for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
All changes seem reasonable to me. I have one question though:
removing the # noqa: S320 in tmt/steps/report/junit.py will now make the linter complain about vulnerability of XML attacks, right? Why were we ignoring it in the first place?
All changes seem reasonable to me. I have one question though: removing the
# noqa: S320in tmt/steps/report/junit.py will now make the linter complain about vulnerability of XML attacks, right? Why were we ignoring it in the first place?
Interesting, I didn't realize this, and ruff should complain. Unless there is something wrong with that rule; I'll check. Plus, if it's to be removed, the comment should go as well.
It was disabled because we intended to parse some strings into XML trees. It's pretty much a "be aware, know what you are doing" message.
All changes seem reasonable to me. I have one question though: removing the
# noqa: S320in tmt/steps/report/junit.py will now make the linter complain about vulnerability of XML attacks, right? Why were we ignoring it in the first place?Interesting, I didn't realize this, and ruff should complain. Unless there is something wrong with that rule; I'll check. Plus, if it's to be removed, the comment should go as well.
It was disabled because we intended to parse some strings into XML trees. It's pretty much a "be aware, know what you are doing" message.
@bajertom aha, S320 rule has been deprecated, and will be removed from ruff. Apparently, lxml has been fixed. So it was removed by the ruff itself.
I don't think this is a good idea, but let's see :) @happz fwiw, quite a lot of cool rules in new ruff versions (also weird that we are enabling --preview instead keeping ruff up-to-date), but since it requires line changes, reviews, etc. I believe it's better to first focus on a) renovate and b) removing EPEL9 rpms and Python 3.9 support.
also weird that we are enabling --preview instead keeping ruff up-to-date
It doesn't seem like one-or-the-other choice to me. Even the current ruff docs, which presumably speak about the current up-to-date ruff, list over a hundred "preview" rules. As I understand it, "preview" rules become regular ones at some point, but it seems new "preview" rules appear as well. So, to me, it seems we can have both.