[yast-devel] Rubocop vs Zombies
No, it's not a movie (yet). What ---- As you know, Zombie Killer aims to replace Ops and Builtins in the code converted from YCP, automatically and safely: https://github.com/yast/zombie-killer Lada recently introduced Rubocop, which can detect a lot of style issues or even bugs, and autocorrect some of them. We have enabled it in Travis for some repositores already: http://lists.opensuse.org/yast-devel/2014-11/msg00066.html Obviously there are similarities between these projects, and luckily, both are based on the same parser library. So Lada has made a prototype of a YaST specific Rubocop plugin, which incorporates big parts of Zombie Killer: https://github.com/yast/rubocop-yast How --- Today we have discussed how to go forward with these. 1. Port Zombie Killer to Rubocop. Rubocop is a well working platform matching closely the aims and even the implementation of ZK. 2. Apply it continuously. Unlike with the switch from YCP, there is no reason to wait for the Zombie Cop to be "complete". We want to implement small features and apply them piece by piece. 3. Distinguish Strict and Tolerant modes. For newly written libraries we want to treat all zombies as offenses but for code converted from YCP we want to convert the ones which are safe to do so and shut up about the rest. 4. Package as a gem only. So far we do not see a need to build a RPM. The package will run in Travis, not in OBS. 5. Measure and present the effects. To make sure that we spend effort effectively, we will produce statistics of zombie counts and their evolution across time, for individual repos and all of YaST. (A simple extension will enable us to get the code quality graphs we currently have on CodeClimate, but for a longer span than one month.) https://codeclimate.com/github/yast/yast-bootloader/trends https://github.com/mvidner/metrics 6. Apply to individual repositores, not across all of YaST?? We are not so confident about (6) and want your opinion about this. Applying a new Zombie Cop across all of YaST has the benefit of generally having more of clean code. The usual maintainer (if any) of that repo does not have to care. On the other hand, some cops,like the logging one, may be a bit aggressive and require fixups to the old tests. There may even be bugs, and those could go unnoticed for a long time for little used and tested modules. So we think it is more appropriate to apply the Zombie Cops (or any cops, actually) only when touching a module for another reason. You will object that it may result of many code changes, which is hard to review. But that is solved by having separate cops for each kind of change, and applying them one per each commit. Next ---- Port all of the current Zombie Killer to a Rubocop plugin, including the tests. -- Martin Vidner, Cloud & Systems Management Team http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
Dne 12.12.2014 v 11:42 Martin Vidner napsal(a): [...]
Today we have discussed how to go forward with these.
1. Port Zombie Killer to Rubocop. Rubocop is a well working platform matching closely the aims and even the implementation of ZK.
Rubocop provides a nice framework, e.g. you can configure, enable/disable each Cop (check) separately, you can run it in detection-only mode or in autocorrection mode, etc... We do not need to reinvent the wheel with ZK and we want to run rubocop checks anyway.
2. Apply it continuously. Unlike with the switch from YCP, there is no reason to wait for the Zombie Cop to be "complete". We want to implement small features and apply them piece by piece.
The advantage is that we are not in hurry now (unlike with the YCP killer). We can kill zombies step-by-step, how time permits.
4. Package as a gem only. So far we do not see a need to build a RPM. The package will run in Travis, not in OBS.
It is already published at rubygems.org (https://rubygems.org/gems/rubocop-yast), you can simply run "sudo gem install rubocop-yast" to install it. If we find a reason to package it as RPM we can build it later, but I'd avoid unnecessary work unless really needed...
6. Apply to individual repositores, not across all of YaST?? [...] So we think it is more appropriate to apply the Zombie Cops (or any cops, actually) only when touching a module for another reason. You will object that it may result of many code changes, which is hard to review. But that is solved by having separate cops for each kind of change, and applying them one per each commit.
JFYI: See https://github.com/yast/yast-registration/pull/177 how I did it in the registration module, each fix was done in a separate commit. -- Ladislav Slezák Appliance department / YaST Developer Lihovarská 1060/12 190 00 Prague 9 / Czech Republic tel: +420 284 028 960 lslezak@suse.com SUSE -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
participants (2)
-
Ladislav Slezak
-
Martin Vidner