You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current selection of Ruff rules comes as a direct translation from when we were using isort, pyupgrade, pycln, Flake8, and some plugins.
It made perfect sense at the time to restrict ourselves to only the most necessary rules, as additional linters and tooling to be installed and run could mean an increase in CI runtime, security risks, upgrade maintenance, and complications between incompatible versions of libraries.
But with Ruff, the context is completely different. It is so fast than any additional rule group is negligible on the runtime and it's a single dependency. Which means that we could enable more rule groups w/o much concerns to help keep our growing non-stubs code up to the best standards. And explore more lints that could be beneficial to stubs.
As a side effect, we get to test various Ruff rules on a very 3rd-party type-stubs-driven repository, helping catch edge-cases and rules that don't belong in that context. This, in my opinion, would further bolster the existing collaboration between Ruff and typeshed, as well as indirectly help the Python typing community that also uses Ruff.
I'm already ready with an experiment PR to see the width and scale of changes this would entail with nearly all rules enabled. Avasam#39 (not something to be reviewed, just a launching point for me, like a possible "todo list")
Of course I would go incrementally: starting with those that already pass as-is, then those covered by autofixes, individually splitting off the more massive ones, finishing with the manual interventions.
It makes sense to me to enable some more ruff rules on this repository — some of the changes in Avasam#39 look very useful! Some look not-so-useful to me, though ;)
I think I'd definitely want to review each rule group being added on its own merits. A lot of ruff's rules are really useful, but not all of them make sense for every codebase. Some are extremely opinionated and enforce patterns that many would disagree with; some don't make sense at all for code in some domains; and some make sense in theory but are so nitpicky that they're pretty annoying to have enforced in CI without autofixes considering the benefits they actually bring.
The current selection of Ruff rules comes as a direct translation from when we were using isort, pyupgrade, pycln, Flake8, and some plugins.
It made perfect sense at the time to restrict ourselves to only the most necessary rules, as additional linters and tooling to be installed and run could mean an increase in CI runtime, security risks, upgrade maintenance, and complications between incompatible versions of libraries.
But with Ruff, the context is completely different. It is so fast than any additional rule group is negligible on the runtime and it's a single dependency. Which means that we could enable more rule groups w/o much concerns to help keep our growing non-stubs code up to the best standards. And explore more lints that could be beneficial to stubs.
As a side effect, we get to test various Ruff rules on a very 3rd-party type-stubs-driven repository, helping catch edge-cases and rules that don't belong in that context. This, in my opinion, would further bolster the existing collaboration between Ruff and typeshed, as well as indirectly help the Python typing community that also uses Ruff.
I'm already ready with an experiment PR to see the width and scale of changes this would entail with nearly all rules enabled.
Avasam#39 (not something to be reviewed, just a launching point for me, like a possible "todo list")
Of course I would go incrementally: starting with those that already pass as-is, then those covered by autofixes, individually splitting off the more massive ones, finishing with the manual interventions.
Checklist
Pyflakes (F)
: Replace Flake8 checks with Ruff (except for flake8-pyi) #11496pycodestyle Error (E)
: Replace Flake8 checks with Ruff (except for flake8-pyi) #11496pycodestyle Warning (W)
: Replace Flake8 checks with Ruff (except for flake8-pyi) #11496mccabe (C90)
: ❌We don't actually mind long and complex tests. This is also very arbitrary, let's make that call on individual reviewsisort (I)
: Replacing isort with Ruff #10912pep8-naming (N)
: Enable Ruff N (pep8-naming) #13327pydocstyle (D)
: Enable Ruff D (pydocstyle) with pep257 convention #13326 &pyupgrade (UP)
: Enable nearly all pyupgrade rules (except on test cases) #11499flake8-2020 (YTT)
: Enable Ruff YTT #13314flake8-annotations (ANN)
: Enable Ruff ANN2 (flake8-annotations, autofixes only) #13331Any
rather thanIncomplete
#9550 is complete,ANN401
could be consideredflake8-async (ASYNC)
:flake8-bandit (S)
:flake8-blind-except (BLE)
:flake8-boolean-trap (FBT)
:flake8-bugbear (B)
: Replace flake8-bugbear with Ruff #11500 & Remove redundant Bugbear disabling in stubs #13308flake8-builtins (A)
:flake8-commas (COM)
:flake8-copyright (CPY)
:flake8-comprehensions (C4)
:flake8-datetimez (DTZ)
:flake8-debugger (T10)
:flake8-django (DJ)
: ❌Not using Django at runtimeflake8-errmsg (EM)
:flake8-executable (EXE)
:flake8-future-annotations (FA)
: Use Ruff forfrom __future__ import annotations
checks #10910flake8-implicit-str-concat (ISC)
:flake8-import-conventions (ICN)
:flake8-logging (LOG)
: ❌Not using logging at runtimeflake8-logging-format (G)
: ❌Not using logging at runtimeflake8-no-pep420 (INP)
:flake8-pie (PIE)
:flake8-print (T20)
: ❌We use print as a logging mechanismflake8-pyi (PYI)
: Add some ruff autofixes to CI #10458 and ongoingflake8-pytest-style (PT)
: ❌Not using pytest at runtime / in our test suiteflake8-quotes (Q)
: ❌This should be fully covered by formatters (whether Black or Ruff)flake8-raise (RSE)
:flake8-return (RET)
: Enable Ruff RET (flake8-return) #13323flake8-self (SLF)
:flake8-slots (SLOT)
:flake8-simplify (SIM)
: Enable Ruff SIM #13309flake8-tidy-imports (TID)
: ❌Banned APIs need to be configured to be useful. A mix of stubs use relative imports.flake8-type-checking (TC)
: Enable Ruff TC (flake8-type-checking) #13333flake8-gettext (INT)
: ❌Not using gettext or translationsflake8-unused-arguments (ARG)
:flake8-use-pathlib (PTH)
:flake8-todos (TD)
:flake8-fixme (FIX)
: It doesn't make sense to block the CI on TODOseradicate (ERA)
: Way too many false-positivespandas-vet (PD)
: ❌Not using Pandas at runtimepygrep-hooks (PGH)
: Enable Ruff PGH rules #13304Pylint Convention (PLC)
: Enable Ruff PLC (Pylint Convention) #13306Pylint Error (PLE)
: Enable Ruff PLE (Pylint Error) #13305Pylint Refactor (PLR)
: Enable Ruff PLR (Pylint Refactor) #13307Pylint Warning (PLW)
:tryceratops (TRY)
:flynt (FLY)
:NumPy-specific rules (NPY)
: We may have to reference or support deprecated numpy types at timesFastAPI (FAST)
: ❌Not using FastAPI at runtimeAirflow (AIR)
: ❌Not using Airflow at runtimePerflint (PERF)
: Enable Ruff PERF #13312refurb (FURB)
: Enable Ruff FURB #13310pydoclint (DOC)
: (all in preview, enabling this would do nothing atm)Ruff-specific rules (RUF)
: Replace Flake8 checks with Ruff (except for flake8-pyi) #11496The text was updated successfully, but these errors were encountered: