you are viewing a single comment's thread
view the rest of the comments
[–] [B] 12 points 1 year ago (4 children)

Do formatting and linting and such autofix issues automatically as part of pre-commit checks. That way they don't end up as part of the CI.

  • source
  • hideshow 8 child comments
  • [–] 7 points 1 year ago (1 child)

    You need them in CI anyway to check people have actually done that, but yeah you definitely don't need to have CI automatically fix formatting and commit the fixes. That's crazy.

  • source
  • parent
  • hideshow 2 child comments
  • [–] [B] -4 points 1 year ago* (1 child)

    No, you don't.

    To check if people have done what - committed? That's the only thing they need to do, and they'll stumble upon a roadblock immediately if the typecheck or lint fails.

    Committing itself won't be possible... That's why we have automated pre-commit checks that don't depend on people remembering to do them manually.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 4 points 1 year ago (1 child)

    To check that people ran the pre-commit linters.

    Committing itself won’t be possible

    That's not how pre-commit hooks work. They're entirely optional and opt-in. You need CI to also run them to ensure people don't forget.

  • source
  • parent
  • hideshow 2 child comments
  • [–] [B] -2 points 1 year ago (1 child)

    They're optional if you make them optional. I didn't. You do as you please. 😄

  • source
  • parent
  • hideshow 2 child comments
  • [–] 5 points 1 year ago (1 child)

    No, they're inherently optional in Git. There's no way to "check in" a git hook. You have to put in your README

    Clone the repo and then please run pre-commit install! Oh and whatever you do don't git commit --no-verify!

    You definitely need to actually check the lints in CI. It's very easy though, just add pre-commit run -a to your CI script.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 1 year ago

    This is the way. I do my checks on pre push because my team has a PR driven workflow. I also have an alias to run-tests && git push origin HEAD since my tests are expensive (minutes to run thousands of tests), and I didn't want that in a git hook.

  • source
  • parent
  • [–] 2 points 1 year ago (1 child)

    If it's open source I'd still add it, because a lot of people can't follow basic instructions.

  • source
  • parent
  • hideshow 2 child comments