swap flake8 and other tools for ruff#102
swap flake8 and other tools for ruff#102strangiato wants to merge 1 commit intoopenshift-psap:mainfrom
Conversation
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
pyproject.toml (1)
30-34: Ruff Basic Configuration Added
The new[tool.ruff]section with a line length of 120 and auto-fix enabled is correctly introduced. One point to consider is whether havingfix = trueby default fits your workflow—automatic code modifications on every run could potentially alter code in unintended ways if not closely monitored.tox.ini (1)
28-33: Updated Lint Environment in tox.ini
The[testenv:lint]environment now callspython -m ruff check . --fix. Please verify that using the--fixflag during linting fits your desired workflow, as it will automatically modify code when issues are detected.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.flake8(0 hunks)pyproject.toml(1 hunks)test-requirements.txt(1 hunks)tox.ini(1 hunks)
💤 Files with no reviewable changes (1)
- .flake8
🔇 Additional comments (4)
pyproject.toml (1)
35-51: Ruff Linting Rules Configuration
The[tool.ruff.lint]section clearly specifies the linting categories (F, B, D, I, PL) and includes an ignore list for conflicting codes. Keeping additional linting rules commented out provides flexibility for future enhancements.test-requirements.txt (1)
1-4: Updated Linting Tools in test-requirements.txt
The removal of legacy linting tools in favor of addingruffstreamlines the testing requirements. Ensure that tools likebashateremain intentional for shell script linting.tox.ini (2)
22-27: Updated Format Environment in tox.ini
The[testenv:format]environment now usespython -m ruff format ., which aligns well with the overall strategy to replace flake8 with Ruff for formatting.
34-42: Consolidated Linters Environment in tox.ini
The[testenv:linters]section aggregates the formatting and linting commands effectively. The commented note to re-enable pylint in a follow-up PR is a clear indicator of future improvement areas.
This PR replaces flake8 and other linting tools with ruff:
https://docs.astral.sh/ruff/
Why Ruff?
It is the defacto standard for nearly every major python project today. It is lightning fast, and supports all of the various linting rules that have already been installed in this project, plus more.
This PR configures all of the same linting rules that were installed with flake8 plus the other tools listed in the
test-requirements.txt.I also included a few additional rules that I would recommend that are currently commented out that can be added later.
However, this project does not appear to be conforming to it's own linting rules and the rules that are installed by this project are not enforced.
In order to simplify this PR, I have not included any of the automatic formatting/fixes that these rules will apply. I would be more than happy to execute those fixes as a separate PR and help to do some manual cleanup of the linting rules if this PR is accepted.
Summary by CodeRabbit