-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Add ruff dependency and configuration #36
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #36 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 18 18
=========================================
Hits 18 18 ☔ View full report in Codecov by Sentry. |
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This PR was closed because it has been stalled for 7 days with no activity. |
This issue was closed by stalebot. It has been reopened to give more time for community review. See biocommons coding guidelines for stale issue and pull request policies. This resurrection is expected to be a onos.environ["GITHUB_TOKEN"]e-time event. |
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
I'd add one thought here, in addition to my comment in #3 : Ruff development moves very quickly, and new rules are opted-in by default, which can cause headaches in CI (eg an aesthetic change like touching up the docs can fail because new code checks have been introduced). For this reason, we pin an exact Ruff version and have a policy of revisiting it about every 6 months. |
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This PR was closed because it has been stalled for 7 days with no activity. |
There's some room for discussion about particular Ruff rules/configs. Experimentally, I think Note: I'm not totally sure how to handle testing of the boilerplate code contained here -- I |
Other notes: I've left off two linting groups, flake8-annotations and flake8-pydocstyle because I think they'd be a big lift to achieve compliance with. Worth eventually implementing IMO. |
@biocommons/maintainers did anyone else want to review this before it gets merged in? |
edited description by @jsstevenson:
close #3
cqa
makefile target to do the same (just check), andreformat
target to actually format.Specific rule groupings selected (note that many specific rules also include auto-fixability -- so while they're nitpicky, they're also self-executing):
F, E, W
: the ~rough equivalent of base Flake8I
: isortN
: Pep8 naming. Rules for variable names. https://docs.astral.sh/ruff/rules/#pep8-naming-nUP
: PyUpgrade. Flags cases where newer Python versions have introduced features intended to replace what's been flagged. https://docs.astral.sh/ruff/rules/#pyupgrade-upYTT
: proper usage ofsys.version
https://docs.astral.sh/ruff/rules/#flake8-2020-yttS
: flake8-bandit, flags security issues https://docs.astral.sh/ruff/rules/#flake8-bandit-sB
: flake8-bugbear, flags common error-prone practices like using a multi-char string as an arg to.strip()
or mutable collections as default args https://docs.astral.sh/ruff/rules/#flake8-bugbear-bA
: flag variables that shadow builtins # https://docs.astral.sh/ruff/rules/#flake8-builtins-aC4
: best practices for comprehensions https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4DTZ
: best practice for datetimes # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtzEM
: don't provide literals to exceptions. I'm 50/50 on this one. https://docs.astral.sh/ruff/rules/#flake8-errmsg-emLOG
: logger best practices https://docs.astral.sh/ruff/rules/#flake8-logging-logG
: logger formatting best practices https://docs.astral.sh/ruff/rules/#flake8-logging-format-gPIE
: catch a few kinds of redundant or repetitive statements https://docs.astral.sh/ruff/rules/#flake8-pie-piePT
: pytest best practices # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-ptRSE
:raise MyError()
->raise MyError
https://docs.astral.sh/ruff/rules/#flake8-raise-rseRET
: unnecessary/superfluous return/other kinds of control flow things # https://docs.astral.sh/ruff/rules/#flake8-return-retSIM
: simplify various kinds of compound statements (most autofixable) # https://docs.astral.sh/ruff/rules/#flake8-simplify-simARG
: unused args # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-argPTH
: force use of pathlib. This will entail # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pthPL
: lots of pylint rules # https://docs.astral.sh/ruff/rules/#pylint-plTRY
: best practices around try/catch # https://docs.astral.sh/ruff/rules/#tryceratops-tryPERF
: some pretty simple performance goofs # https://docs.astral.sh/ruff/rules/#perflint-perfRUF
: custom rules original to Ruff. There's some interesting stuff here. https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf