• kamen@lemmy.world
    link
    fedilink
    arrow-up
    24
    arrow-down
    1
    ·
    3 months ago

    The pipeline should handle formatting. No matter how you screw it up, once you commit, it gets formatted to an agreed upon standard.

      • FizzyOrange@programming.dev
        link
        fedilink
        arrow-up
        5
        ·
        3 months ago

        Yeah I think that’s what he meant. You don’t want CI editing commits.

        I use pre-commit for this. It’s pretty decent. The major flaws I’ve found with it:

        • Each linter has to be in its own repo (for most linter types). So it’s not really usable for project-specific lints.

        • Doesn’t really work with e.g. pyright or pylint unless you use no third party dependencies because you need a venv set up with your dependencies installed and pre-commit (fairly reasonably) doesn’t take care of that.

        Overall it’s good, with some flaws, but there’s nothing better available so you should definitely use it.

    • sunbytes@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      3 months ago

      Some diff tools don’t handle indentation by default.

      So if you add a wrapper, it counts everything inside it as “changed”

      • kamen@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        3 months ago

        Pre-commit hooks is a common approach to this, so that whatever is committed gets processed. Another possibility would be to set a bot on the repo to do automated commits after human-made ones, but that can get a little noisy.