Skip to content

build: replace Python linter flake8 with ruff - #47519

Merged
nodejs-github-bot merged 3 commits into
nodejs:mainfrom
cclauss:ruff
Apr 14, 2023
Merged

build: replace Python linter flake8 with ruff#47519
nodejs-github-bot merged 3 commits into
nodejs:mainfrom
cclauss:ruff

Conversation

@cclauss

@cclausscclauss commented Apr 12, 2023

Copy link
Copy Markdown
Contributor

Ruff supports over 500 lint rules and can be used to replace Flake8 (plus dozens of plugins), isort, pydocstyle, yesqa, eradicate, pyupgrade, and autoflake, all while executing (in Rust) tens or hundreds of times faster than any individual tool.

The ruff Action uses minimal steps to run in ~5 seconds, rapidly providing intuitive GitHub Annotations to contributors.

image

@charliermarsh

@nodejs-github-bot

nodejs-github-bot commented Apr 12, 2023

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/python

@nodejs-github-botnodejs-github-bot added build Issues and PRs related to build files or the CI. dont-land-on-v14.x gyp Issues and PRs related to the GYP tool and .gyp build files i18n-api Issues and PRs related to the i18n implementation. icu Issues and PRs related to the ICU dependency. meta Issues and PRs related to the general management of the project. needs-ci PRs that need a full CI run. openssl Issues and PRs related to the OpenSSL dependency. tls Issues and PRs related to the tls subsystem. tools Issues and PRs related to the tools directory. labels Apr 12, 2023
@cclauss
cclaussforce-pushed the ruff branch 2 times, most recently from 6bba85d to 9da5ea6CompareApril 12, 2023 01:25
@cclausscclauss changed the title ci: replace Python linter flake8 with ruffbuild: replace Python linter flake8 with ruffApr 12, 2023

@anonriganonrig left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm a fan of Ruff. I was planning on doing this change. Happy to see this. Can you share the execution time difference with this change?

@TrottTrott added the python PRs and issues that require attention from people who are familiar with Python. label Apr 12, 2023
@gengjiawengengjiawen added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 12, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 12, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@cclauss

Copy link
Copy Markdown
ContributorAuthor

@anonrig Execution time is less than a 1/10th of a second.

node git:(ruff) % time ruff .

ruff . 0.08s user 0.09s system 85% cpu 0.197 total

@gengjiawen

gengjiawen commented Apr 12, 2023

Copy link
Copy Markdown
Member

node-test-linter failed, not sure extra build steps needed @nodejs/build-infra

@cclauss

Copy link
Copy Markdown
ContributorAuthor

These errors are caused by the mods that are made in the Makefile. Ruff is a Rust exe while flake8 was a Python command line tool. I will convert this PR to DRAFT while I work to fix...

@cclauss
cclauss marked this pull request as draft April 12, 2023 09:28
@cclauss
cclauss marked this pull request as ready for review April 12, 2023 11:14
Comment threadMakefile Outdated
@nodejsnodejs deleted a comment from tungmeooApr 12, 2023
@richardlaurichardlau added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. request-ci Add this label to start a Jenkins CI on a PR. labels Apr 14, 2023
@richardlau

Copy link
Copy Markdown
Member

The five failures look unrelated but perhaps I am missing something.

We have a number of flaky tests (more since the recent V8 update).

@MoLowMoLow removed tls Issues and PRs related to the tls subsystem. openssl Issues and PRs related to the OpenSSL dependency. i18n-api Issues and PRs related to the i18n implementation. gyp Issues and PRs related to the GYP tool and .gyp build files icu Issues and PRs related to the ICU dependency. labels Apr 14, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 14, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@gengjiawengengjiawen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Excellent job

@richardlaurichardlau added the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 14, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 14, 2023
@nodejs-github-bot
nodejs-github-bot merged commit 4c22414 into nodejs:mainApr 14, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 4c22414

@cclauss
cclauss deleted the ruff branch April 14, 2023 16:52
@cclauss

cclauss commented Apr 14, 2023

Copy link
Copy Markdown
ContributorAuthor

Thanks all! -- Its a team sport ;-) If you are involved nodejs/build, please give this a review so I can complete the tour...

targos pushed a commit that referenced this pull request May 2, 2023
PR-URL: #47519
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
@targostargos mentioned this pull request May 2, 2023
danielleadams pushed a commit that referenced this pull request Jul 6, 2023
PR-URL: #47519
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
MoLow pushed a commit to MoLow/node that referenced this pull request Jul 6, 2023
PR-URL: nodejs#47519
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

buildIssues and PRs related to build files or the CI.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.metaIssues and PRs related to the general management of the project.needs-ciPRs that need a full CI run.pythonPRs and issues that require attention from people who are familiar with Python.toolsIssues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@cclauss@nodejs-github-bot@gengjiawen@richardlau@anonrig@MoLow@Trott