add ruff linter to functional2 pytests #812
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#812
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Is your feature request related to a problem? Please describe.
Currently there is no linting or anything else denoting common code styling for functional2 tests.
Hence, there is also no pre-commit/mr check if the guidelines are followed
Describe the solution you'd like
As has been discussed in the Lix-Development channel somewhen,
ruff
should be added as a linter.It supports pre-commit hooks, which should be enabled as well.
The style configuration can be added to the pyproject.toml
I would suggest having all configuration options enabled and clearly set to avoid discussions and differentiating code-styles in the future
Describe alternatives you've considered
black
has also been suggested, but disregarded in advantage ofruff
, as the latter is faster and a drop-in replacement forblack
Additional context
ruff has also been mentioned in the wiki as to be added at a later point in time
My intention for this issue is for it to be a discussion point for which style guides to use and to keep track of who is currently working on the implementation
This issue was mentioned on Gerrit on the following CLs:
should ruff be scoped to only run on functional2 or be scoped to include all python files within lix?
Eventually having more linting is definitely a good thing, and I'm in favour, but starting with functional2 is a great idea as it'll let us make incremental progress.
i definitely see the point, but if you check out the pr (the pre-commit stuff) it does introduce some imo hacky stuff
That's totally okay for now.
Love linting, love pre-commit hooks. I'll check out the CL later and try my best to review.
Open Q: can Ruff be beat into working with Xonsh, or is it completely impossible? It might give us clues as to where to go long-term (like maybe massively shrinking Xonsh code size in favor of pure Python).
@kfearsoff wrote in #812 (comment):
It doesn't matter much, there's nearly zero logic in xonsh files today, so a linter doesn't achieve very much. Trying to get it working on xonsh doesn't seem like a particularly important job for that reason imo.
About the docstrings:
as of rn, pydoclint doesn't support sphinx docs yet; a pr is open though (last interaction in september 2024)
supported styles are google, numpy and pep275
should we move to one of those or wait until sphinx is supported?
personally i am not a fan of the other docstring styles.
continuing on that, while pydoclint itself supports sphinx styling, the ruff implementation doesn't yet (see https://github.com/astral-sh/ruff/issues/12434)
goofy! can we ignore the problem for now? it seems plausible that we could just not lint doc strings until they invent a linter that supports them; it's not like sphinx doc strings are a rare use case.
Either that or go with google style