overcommit icon indicating copy to clipboard operation
overcommit copied to clipboard

[Feature request] Check for all ruby files to have `frozen_string_literal` pragma

Open alfuken opened this issue 3 years ago • 2 comments

I've tried searching for this one through the project but to no avail. Hence the feature request: it [w|c]ould be a good idea to add a check for presence of frozen_string_literal pragma either in all ruby files or only in new ruby files that go through the git hooks pipeline.

I know about the "if you want it - make a PR" rule, and, although this doesn't look like a very complicated check to implement, I'm not yet that familiar with Overcommit, and I think that for someone more experienced with all this it would take much less time to implement, than for someone new. But, if no one will, I guess I'll probably get to it, eventually.

alfuken avatar Nov 22 '22 09:11 alfuken

There is a rubocop cop for that :)

https://docs.rubocop.org/rubocop/cops_style.html#stylefrozenstringliteralcomment

hobbypunk90 avatar Feb 08 '23 06:02 hobbypunk90

There is a rubocop cop for that :)

https://docs.rubocop.org/rubocop/cops_style.html#stylefrozenstringliteralcomment

True, but I do have mixed feelings towards rubocop - it's waaay too opinionated, and most of it (especially in style and metrics area) is a matter not of objective value, but merely of subjective personal preference, which they're trying to, by default, bestow upon others (and trying to turn ruby into a python along the way, with it's disdain towards TIMTOWTDI).

Also, that's Yet-Another/One-More Tool to add for something as simple as this... It's like using kubernetes to host a SPA - trendy, hypey, but not practical ;)

alfuken avatar Feb 08 '23 10:02 alfuken