Skip to content

Use library for git pre commit hook #222

Open

Description

@sverhoeven

Currently we can use a git hook on pre commit to check style and import order with


This is a handcrafted script which could be replaced with the https://pre-commit.com/ library.
Switching to pre-commit.com would gives us a declarative approach (config file), which to me is better then a imperative program (shell script). Also the many available plugins would make it easier for developers of the project to extend what happens in the hook.

The shell script was added for #82, to get basic git hook.

Activity

  1. added
    generated-packageRelated to the generated package, i.e. after running cookiecutter
    on Apr 22, 2021
  2. added this to the milestone on Apr 22, 2021
  3. removed this from the milestone on Apr 28, 2021
  4. bouweandela commented on Feb 14, 2023

    @bouweandela
    Member

    And recommend using pre-commit CI? It's nice, but all people working on the project need to know git reasonably well because it pushes changes to a branch you're working on, so everyone in the project needs to be happy about fixing the occasional merge conflict.

  5. abelsiqueira commented on Sep 8, 2023

    @abelsiqueira
    Member

    Seconding this. After using pre-commit for a few projects, including a Julia project, it is much easier to maintain and contains many useful hooks that are also useful as the default linter.

    We can drop some explicit package requirements and use pre-commit instead.

    It is also much easier to add zero-conf or low-conf hooks since you just have to change a few lines in the .pre-commit-hook.yaml.
    So adding linters and formatters for markdown, yaml, json, and even CITATION.cff is much easier.

    For the CI, we can run pre-commit run -a to run all linters and formatters which will also decrease the number of actions.

    I wouldn't recommend the pre-commit CI, that can be left to the discretion of the repo owner.

  6. egpbos commented on Dec 20, 2023

    @egpbos
    Collaborator

    Following #336, it would be nice if this config adds some good default choices, like ruff format and black.

  7. self-assigned this
    on Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

generated-packageRelated to the generated package, i.e. after running cookiecutter

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions