Alt

Indiana Jones swapping out an artifact for a fake one meme template with the text “existing code” on the real artifact, “new commit” on the fake one, and “linter” on the pedestal / trap

  • kabi@lemm.eeOP
    link
    fedilink
    arrow-up
    2
    ·
    24 days ago

    The idea for the meme came to me regarding contributing to a project for the first time. It’s not like I will push trash code, but if I accidentally didn’t add exactly two newlines between something and it starts complaining…

    • lunarul@lemmy.world
      link
      fedilink
      arrow-up
      9
      ·
      24 days ago

      If there’s a linter with such opinionated rules there should also be a pre-commit hook that auto-formats accordingly.

        • lunarul@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          22 days ago

          That’s up to each individual developer’s own setup. But hooks are a way to ensure uniformity since they apply to all commits.

          • douglasg14b@programming.dev
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            21 days ago

            Why would it be on each dev to setup?

            Your repo can, and should, include workspace settings for major editors that provide a uniform experience for anyone onboarded to the platform.

            I agree that precommit hooks are good for uniformity. But slow pre commit hooks are frustrating, they are also often turned off. Your CI will always be the last gatekeeper for linting/formatting rules regardless.

            Making precommit hooks slower means more devs disable them, which is the opposite of what you want. Save them for simple, read, checks and validations that can run in < 1s for even huge changesets.

    • douglasg14b@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      22 days ago

      That’s not a linting problem that’s a formatting problem.

      That project should have automatic formatting on save setup.

      Linters are not necessarily formatters they’re solving two different problems and are becoming increasingly separated in their toolset.