RuboCop common styles in gem

During the effort for unifying the RuboCop runs on our Jenkins and making it more reliable and helpful, we’ve decided to create a common gem, that would be used by core and would offer the plugin maintainers the same set of RuboCop rules as core uses.

Repo should keep the cops tidy and disable only the very irritating cops, but allow a choice for plugin maintainers to use only some category of the rules or override the config in their .rubocop file.

Advantages:

  • Enables to run simple bundle exec rubocop on CI of choice without a need to have foreman core repository around
  • versioning this gem allows plugin maintainers upgrade at their pace
  • no need to copy the rules over to the plugin and wondering what rule is disabled just because core is not ready yet
  • rules organization into categories
  • discussions about rules in GH issues in the repo will make them easy to search

Disadvantages (caveats):

  • We need to decide what rules to enable
  • We need to migrate all plugins
  • We need to name the gem

The last caveat being the hardest to solve, thus the most urgent, please help with that.

  • theforeman-rubocop
  • theforeman-styles
  • rubocop-foreman
  • idontcare
0 voters

If you have any insight on how to vote on the rules, or idea how to organize the cops, your voice is welcome!

My thought process:

  • Of course I care, so idontcare is not an option for me :wink:
  • theforeman-styles might suggest it also includes other things - including rubocop is IMHO a good thing.
  • It’s not really a rubocop plugin so rubocop-foreman feels wrong
  • That leaves theforeman-rubocop.
2 Likes

I’ve had a similar thought process :slight_smile:
Although someone might argue we can add another styles (javascript) in the future, or that we might add our own rules.

But I guess what future brings is in the wind and we should not meditate on that before it comes, given it doesn’t seem likely ATM.

Just to mention: obviously if someone can think of even better name than I got in the poll, please share it with us! :slight_smile:

I doubt we’ll apply Javascript styles via a gem so it’ll likely be shipped in a different repo.

Probably theforeman-rubocop-style to capture the fact that it’s not rubocop itself but a style.

What is the status of this effort? Are you tracking some TODO list in this regard? It looks like we have landed on a name, github repo now exists and no objections were raised. I do believe this is worth the effort.

What I see is:

  • Update foreman_template template plugin
  • Update other major plugins (file PRs, maintainers will decide if they like it or not)
  • Update our Handbook manual with instructions where to find those rules

Thanks

I also have a suggestion for versioning. Since every single change can cause test breakage for plugins, semantic versioning or any kind of arbitrary versioning does not make much sense. So I propose to do some time-based versining: 2021.3.29 in the format of YYYY.M.D.

Plugin authors can then decide how often they will get updates - yearly, monthly or daily.