• Australis13@fedia.io
    link
    fedilink
    arrow-up
    28
    arrow-down
    1
    ·
    edit-2
    4 months ago

    I felt that. I have a colleague whose coding style is different to mine and whenever they work on code that I originally wrote, I have to resist the temptation to modify things to camelCase.

    • mesamune@lemmy.world
      link
      fedilink
      English
      arrow-up
      47
      arrow-down
      1
      ·
      4 months ago

      Linters make these kind of things easier. Then you get mad at the tool rather than your coworker.

      • flashgnash@lemm.ee
        link
        fedilink
        arrow-up
        10
        ·
        4 months ago

        Does Prettier count as a linter?

        I always thought linters were more to find bad practice and possible errors than control the code style

        • Australis13@fedia.io
          link
          fedilink
          arrow-up
          14
          ·
          4 months ago

          Some linters can do both. Getting one set up as an automated job whenever code is pushed to the repo is on my TODO list…

          • mesamune@lemmy.world
            link
            fedilink
            English
            arrow-up
            4
            ·
            4 months ago

            Yep all my public repos have it on a ci job. When you have a library that is used on many different projects, I want to be able to read the prs.

          • flashgnash@lemm.ee
            link
            fedilink
            arrow-up
            4
            arrow-down
            1
            ·
            4 months ago

            That does sound nice to me too. I’ve found prettier with format on save works pretty well but that means you have to set it up in every editor

            • RustyNova@lemmy.world
              link
              fedilink
              arrow-up
              8
              ·
              4 months ago

              Format on save is a godsend. Copy paste something with whole indentation? Ctrl-s, it’s back to normal. Did some wacky nested anonymous function calls? Ctrl-s, and they’re laid out nicely.

              • GissaMittJobb@lemmy.ml
                link
                fedilink
                arrow-up
                2
                ·
                4 months ago

                I honestly almost golf my code nowadays and just let the tooling fix formatting for me. The space bar and enter key are in an ideal world vestigial for the purposes of programming.

                • RustyNova@lemmy.world
                  link
                  fedilink
                  arrow-up
                  1
                  ·
                  4 months ago

                  I’ll always say that the best code editor is the one that makes you put your idea onto a file the fastest.

                  So yeah, you shouldn’t worry about style and code lint. You should worry if your code is sound and works. Keep your mind on the logic, not the extras

    • AggressivelyPassive@feddit.de
      link
      fedilink
      arrow-up
      14
      ·
      4 months ago

      It’s interesting that something this minor gets people so upset. I mean, I get it, but objectively it’s weird of us.

      I had a debate years ago about test naming. When I was a junior, the lead dev used test methods with an underscore separating different cases. Like testServiceConnector_success(). I thought that’s pretty neat and kept that style. In another project one of the devs almost had a meltdown because I dared introducing underscore scum into “his” project.

      • Australis13@fedia.io
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        4 months ago

        I think it’s just that we’re possessive/protective of “our” code, even more so if one is passionate about programming. We’ve put a lot of effort into it, then somebody else comes along and “ruins” our “perfect” (to our eyes) formatting/styling!

    • EtzBetz@feddit.de
      link
      fedilink
      arrow-up
      8
      ·
      4 months ago

      Last year I had a module for ai stuff. We did things in Python and I am quite into doing things as coding standards say. My mate didn’t really care so much and just went for his style of doing things, also not really worrying about descriptive names etc.

      Well, let’s say, we weren’t having a good time.

      I also realized that I was probably too harsh and tried to go a bit more easy on it later, but many things just felt wrong.

      • GBU_28@lemm.ee
        link
        fedilink
        English
        arrow-up
        9
        ·
        4 months ago

        Add black, isort and flake 8 to your repo, you can set it up to be applied on commit.

        So folks can modify their local config all they like, and when they push it’s to the team standard and when they work locally it’s to theirs. It’s the best.