Skip to content

Auto-update pre-commit plugins #734

Open
@lukpueh

Description

@lukpueh

Plugins (most notably isort and black) in .pre-commit-config.yaml are not updated by Dependabot and thus prone to become out of sync with the same dev tools used by tox (also see discussion with @jku in #582).

We should find a way to keep them in-sync.

Activity

jku

jku commented on Feb 14, 2024

@jku
Collaborator

without understanding pre-commit much, how about this:

  • make tox -e lint fast (aka use ruff)
  • start running tox -e lint in a commit hook

I think this would explicitly not use pre-commit itself though.

lukpueh

lukpueh commented on Feb 14, 2024

@lukpueh
MemberAuthor

The difference would be that tox -e lint doesn't reformat your code.

jku

jku commented on Feb 14, 2024

@jku
Collaborator

A tox -e reformat command would be nice to have anyway maybe

lukpueh

lukpueh commented on Feb 14, 2024

@lukpueh
MemberAuthor

I'm always pro lighter toolchain.

L77H

L77H commented on Jul 1, 2024

@L77H
Contributor

With Ruff as our linter now we can add tox -e reformat with ruff format {[testenv:lint]lint_dirs} in tox.ini. We could also add this immediately on tox -e lint by removing the --diff flag on ruff format, this would depend if the suggested reformatting changes should be reviewed first before being performed.

lukpueh

lukpueh commented on Jul 2, 2024

@lukpueh
MemberAuthor

In my experience, reformatting and format checking + linting are usually separated. But I suppose we can combine them, now that both of them are so fast. The important thing is that tox -e lint fails CI, if the format is incorrect. What do others think?

jku

jku commented on Jul 2, 2024

@jku
Collaborator

I think the autofix/autoformat feature is not a must-have but I'm not complaining if it's there. I wouldn't add it to lint itself though -- it feels like there should be a way to "just test", not fix.

In python-tuf I added tox -e fix which ends up running something like

ruff check --fix <DIRS>
ruff format <DIRS>
lukpueh

lukpueh commented on Jul 2, 2024

@lukpueh
MemberAuthor

I wouldn't add it to lint itself though -- it feels like there should be a way to "just test", not fix.

Agreed. Not so much because I want to be able just test, but more because I don't want change anyone's sources when they don't expect it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionIssues that require discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Auto-update pre-commit plugins · Issue #734 · secure-systems-lab/securesystemslib