New trailing comma style in foreman.git

Note that we started to require trailing commas in arrays and hashes. Be careful when merging PRs:

I’ve just submitted the first, but we’ll likely see more:

1 Like

I hate this, both Ruby and JavaScript are supposed to be expressive languages and this creates another need of paying attention to useless detail and overall this is counter-productive in my opinion. I understand that copy-pasting lines can be faster, however that is nothing compared to minutes and hours spent in total fixing those pesky Rubocop failures for literally no reason.

It makes diffs smaller as well. That reduces the chance for merge conflicts which makes cherry picks easier. I really hate missing trailing commas for that reason. We know we aren’t going to make everyone happy, but Rubocop is about standardizing as a group so that collaboration is easier. Also note Rubocop has an autofix mode and it can automatically fix this using rubocop -a.

Requiring that there not be a trailing comma (as was the case before) created an equal need to “pay attention to useless detail”.

Except that now there is a clear reason for why the new convention is preferable to the old one. (All list elements are syntactically equal, and as a consequence diffs will show what list elements were actually changed.)

There are surely bigger fish to fry in the world, but this strikes me as an entirely rational change of convention.


Sure that one was terrible too, if this was not clear from my words let me state: no check should be performed on this one, developers should be allowed to do it one way or the other. Added benefit is almost zero compared to the burden added.

I have couple of other candidates, I think we are trying to be golang codebase but that’s language is totally different story. Go has a very opinionated formatter from the very early days (beta versions had it already) and that works fine because there is just one standard. I love that, however I believe Ruby is not the right environment to follow that path.

Don’t get me wrong, I think Rubocop is a wonderful tool and project. There are many cops which are great, but I would be very cautious about these tiny details that can do more bad than good.

I did misunderstand before.
Between the old linter rule and the new one I prefer the new one. It enforces my preferred style.
But I totally get that there is an argument against enforcing the minutae of someones preferred style for everyone.

1 Like