Skip to content

swap flake8 and other tools for ruff#102

Open
strangiato wants to merge 1 commit intoopenshift-psap:mainfrom
strangiato:ruff
Open

swap flake8 and other tools for ruff#102
strangiato wants to merge 1 commit intoopenshift-psap:mainfrom
strangiato:ruff

Conversation

@strangiato
Copy link
Copy Markdown

@strangiato strangiato commented Mar 27, 2025

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

  • Chores
    • Consolidated code quality tools to streamline formatting and linting.
    • Replaced multiple legacy static analysis tools with a unified solution that offers automatic fixes.
    • Updated internal configurations to enhance consistency and maintainability.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 having fix = true by 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 calls python -m ruff check . --fix. Please verify that using the --fix flag 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

📥 Commits

Reviewing files that changed from the base of the PR and between 831ad50 and dc1aef3.

📒 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 adding ruff streamlines the testing requirements. Ensure that tools like bashate remain intentional for shell script linting.

tox.ini (2)

22-27: Updated Format Environment in tox.ini
The [testenv:format] environment now uses python -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.

@openshift-psap openshift-psap deleted a comment from coderabbitai Bot Mar 28, 2025
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