Skip to content

Add pre-commit#575

Draft
stephenfin wants to merge 2 commits intotesting-cabal:masterfrom
stephenfin:pre-commit
Draft

Add pre-commit#575
stephenfin wants to merge 2 commits intotesting-cabal:masterfrom
stephenfin:pre-commit

Conversation

@stephenfin
Copy link
Contributor

Seeing as I keep forgetting to run ruff when submitting PRs 😅

commands =
ruff check --fix .
ruff format .
pre-commit run -a
Copy link
Member

Choose a reason for hiding this comment

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

can we avoid this? I'm happy to see config for pre-commit shipped, but don't really want to add it as a hard dependency.

Copy link
Contributor Author

@stephenfin stephenfin Feb 28, 2026

Choose a reason for hiding this comment

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

The concern with not doing this is that you end with two linter configurations which may subtly differ. This usually means someone who uses pre-commit will end up getting a whole load of fixes on unrelated code because others haven't run it for X time.

More to the point, I don't think there's really a dependency here. It's not needed at runtime. Distro packagers don't need to worry about. Devs don't need to even install it on their system since they can just rely on tox to do so. (I also wouldn't call tox a dependency for similar reasoning)

Copy link
Member

@jelmer jelmer Feb 28, 2026

Choose a reason for hiding this comment

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

So I'm happy to see pre-commit config added if people find that helpful. It does add extra overhead in cases that aren't really precommits (i.e. CI) and I don't personally use it.

We already have configuration for ruff, tox, CI, testr as well as a Makefile that all have config for how to run tests/linting/etc.

We can use tox for this nowadays.

Signed-off-by: Stephen Finucane <stephen@that.guru>
@stephenfin stephenfin force-pushed the pre-commit branch 2 times, most recently from 2fbc4bb to 9dcff1b Compare February 28, 2026 11:44
Signed-off-by: Stephen Finucane <stephen@that.guru>
@stephenfin
Copy link
Contributor Author

Let me hold this for a bit while I investigate hatch envs. Maybe we can call that from pre-commit and get the best of both worlds. We might even be able to get rid of tox from the looks of things.

@stephenfin stephenfin marked this pull request as draft February 28, 2026 13:15
@bigjools
Copy link
Contributor

bigjools commented Mar 1, 2026

I yeeted tox from most of my projects in favour of Hatch. It's so much nicer and you can set up scripts that run in the venv context, such as calls to formatting tools 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants