1. 5

  2. 3

    I highly recommend anyone that uses Ruby uses rubocop… it’s an excellent aid.

    Start with the Lint and Performance cops and slowly add in the stylistic ones that you care about.

    It’s autocorrect feature is fantastic as well.

    Hint: Clean up one cop per commit

    1. 2

      Rubocop is kind of neat, but I’ve seen more ‘bug caused by bringing a codebase into compliance with new rules’ than ‘bugs that would’ve been prevented by obeying a cop’, which makes me a little wary.

      1. 1

        Certainly seen a bunch of bugs fixed by the Lint cops, I’m less fond of the Style cops.

      2. 1

        rubocop is nice, but I find that relaxed.style is unfortunately necessary.

      3. 1

        Recently I’ve been working with people coming from other languages to Ruby and I was surprised how useful they found having Rubocop enabled on a project and, also, reek.

        The way I use it is somewhat similar to the relaxed style already mentioned here, meaning that I define a set of rules in .rubocop.yml and we have no .rubocop_todo.yml. I found it’s very helpful for new developers coming into a project to see an offence (thanks to the IDE/editor they are using) and get their first commit by writing a small refactor.

        1. 1

          I’ve been using standardrb in place of plain Rubocop and it feels like a better set of defaults. Folks who don’t find Rubocop to fit quite right might to give it a shot.