Skip to content

NAS-145296 / 27.1.0 / replace flake8 with ruff and format the code with ruff (by yocalebo) - #114

Merged
yocalebo merged 3 commits into
stable/27from
NAS-145296-27.1.0
Nov 17, 2026
Merged

yocalebo merged 3 commits into
stable/27from
NAS-145296-27.1.0

Conversation

@bugclerk

Copy link
Copy Markdown

This replaces flake8 with ruff and formats the code with ruff.

  • ruff check replaces flake8 in the lint job. It runs the same pyflakes and pycodestyle rules. Its settings now live in pyproject.toml, so tox.ini is removed.
  • The code is formatted with ruff format using its default settings. One type ignore comment moved with its argument so mypy still applies it.
  • The lint job now also runs ruff format --check on the Python and Markdown files a pull request adds or changes. Files the pull request does not touch are not checked, so a new ruff release that formats differently will not fail unrelated pull requests.
  • Ruff is installed with astral-sh/ruff-action. The job keeps the name lint, so existing required checks still match.

The formatting commit is large but changes no behavior. The other two commits are easiest to review on their own.

Original PR: #113

Ruff runs the same pyflakes and pycodestyle rules as flake8 and passes on the current code. Its settings now live in pyproject.toml, so tox.ini is no longer needed. The job keeps the name lint so existing required checks still match.

(cherry picked from commit 39bc21b)
@bugclerk

Copy link
Copy Markdown
Author

Automatic cherry-pick failed. Please resolve conflicts by running:

git cherry-pick -x debb1ae5bd467cfcaeb54dc4c5eb231d3e58dd53
git cherry-pick -x 572acdb3be22a317a307a9d4c0e2106b16dc7b37

If the original PR was merged via a squash, you can just cherry-pick the squashed commit:

git reset --hard HEAD~1
git cherry-pick -x 78b93ae7e779599c4349ea273e06e2c28f428c17

@bugclerk

Copy link
Copy Markdown
Author

This is the output of ruff format with its default settings. One type ignore comment moved with its argument so mypy still applies it.

(cherry picked from commit debb1ae)
Pull requests now fail when a new or changed Python or Markdown file does not match ruff format. Files a pull request does not touch are not checked.

(cherry picked from commit 572acdb)
@yocalebo
yocalebo marked this pull request as ready for review November 17, 2026 17:58
@yocalebo
yocalebo merged commit db1b185 into stable/27 Nov 17, 2026
3 checks passed
@yocalebo
yocalebo deleted the NAS-145296-27.1.0 branch November 17, 2026 18:17
@bugclerk

Copy link
Copy Markdown
Author

This PR has been merged and conversations have been locked.
If you would like to discuss more about this issue please use our forums or raise a Jira ticket.

@truenas truenas locked as resolved and limited conversation to collaborators Nov 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants