Use SUSE Ruby style guide
Closed this issue · 6 comments
Is there a reason why we are not using the SUSE Ruby style guide?
Yes, I do not understand why do we have a SUSE Ruby Style. I opened an issue some months ago with some concerns about that guide: https://github.com/SUSE/style-guides/issues/18 I really prefer to follow Rubocop defaults. Rubocop is community maintained, so the concerns can always be raised there and this way we save discussion in individual projects as well as having a unique Ruby style guide and not everybody its own (as happens in other programming languages such as Python). Also, this project is not a SUSE, but an openSUSE project.
Currently we are following rubocop defaults almost strictly. There are just few rules disabled or relaxed: https://github.com/openSUSE/trollolo/blob/master/.rubocop.yml I modified this rules to avoid having to make many changes when introducing Rubocop and making easier new contributions, but once the rest of the offenses are solved, I would be up to follow Rubocop for those rules as well.
I think it makes sense for the areas where there are no clear preference in the community style guide. Example are the string literals. It's true that the style guide is under the SUSE organization, not the openSUSE one, but effectively it's mostly the same people working on code in both organizations, so using the same style makes a lot of sense.
I don't want to create any friction here, so if you have the strong opinion that we should follow the Rubocop defaults, I'm fine with that and we can close this issue.
But I do have a strong opinion on switching off the %w
check. Requiring arrays which happen to contain strings to be written in a different way than other arrays only creates inconsistent code for no real benefit.
It's true that the style guide is under the SUSE organization, not the openSUSE one, but effectively it's mostly the same people working on code in both organizations, so using the same style makes a lot of sense.
That is not really true, I have never worked on a project following SUSE style guide and I also don't see the reason why SUSE needs its own style guide. An even if SUSE wants a style guide, who decide what goes there? People working at SUSE change and rules in Rubocop as well.
But I do have a strong opinion on switching off the %w check. Requiring arrays which happen to contain strings to be written in a different way than other arrays only creates inconsistent code for no real benefit.
Are you fine with changing the default for this and keeping the defaults for the rest? If so I'll modify this in the configuration. 😉
@cornelius Style/WordArray is already disabled. Can we close this issue?
The literals like %w and %i are like a core part of Ruby. I don't see the inconsistency. I like how rubocop suggest delimiters, like braces, brackets and parentheses, so those are consistent. Having %w!a b c! and %w@a b c@ is inconsistent.