Some YaST projects already use Rubocop for checking the code style,
but we froze the Rubocop version to 0.29.1 which is quite old these days
(almost 1.5 year) and it produces some warnings with the latest
common SUSE style  as it is written for newer versions.
I have tried using the latest Rubocop (0.40.0) in some YaST projects
to see how much work the upgrade would require and how much the
code would change.
## Change it now?
My first question is do we actually want to upgrade Rubocop *now*?
IMHO it makes sense to upgrade it now. If we do it now it will save
us some work later with SP2 maintenance when backporting the fixes
For the older branches (SP1 and older) we would stick with the old Rubocop.
I.e. keep the version in the .travis.yml, for Jenkins we would build
two versions of the Rubocop RPM in YaST:Head. And I expect that SP1 will
need less and less fixes after SP2 is released.
## What would be actually changed?
Here is a proposal for the upgrade. We need to update the default
Rubocop config a bit  and then we need to adapt the code
in all YaST projects which use Rubocop.
I have started with the migration module which is small and written
from scratch (i.e. no nasty YCP-Ruby code). The change was easy,
everything was auto-corrected by Rubocop .
Then I tried yast2 which a big beast with a lot of YCP-Ruby code.
You can see the change in . It took me quite some time
as not everything could be autocorrected...
Note: I run each cop (check) in a separate commit so you can see
what has been changed. On the other hand some changes require running more
cops to be finished completely, e.g. a cop changes indentation
of the code, but the comments are unchanged and are indented by a different
cop later in a different commit.
So I you see some strange or incomplete changes in a commit then
check the final result (complete diff), it might be fixed in the end.
Please check the pull requests and comment either there or here on the
## Next Steps
After we agree with the change and the updated style we can adapt the rest .
I guess it should rather easier as the most complex package (yast2)
has been already adapted, the rest should be hopefully easier ;-)
 > find . -maxdepth 2 -name .rubocop.yml | sort
To unsubscribe, e-mail: yast-devel+unsubscribe(a)opensuse.org
To contact the owner, e-mail: yast-devel+owner(a)opensuse.org
We all know that YaST2 is a huge project and it contains a lot of code:
modules, libraries, clients, agents, dialogs... When it comes the organization
of the Ruby code, there some things that we could improve.
After discussing in our Gran Canaria office :) we decided to write a short
document to summarize problems and possible solutions.
It's available in a Gist and we would like to hear your opinions.
Obviously, it's not something to be done right now, but we wanted to start the
discussion about these topics and try to come up with a final proposal for the
Imobach González Sosa
YaST team at SUSE LINUX GmbH