[yast-devel] zombie-killer-0.5 with an eager mode
Hi, it was Halloween last week so my mind turned to zombies, in particular those beginning with Yast::Builtins and Yast::Ops. As you may remember, we have a zombie killer: https://rubygems.org/gems/zombie-killer https://github.com/yast/zombie-killer Originally I set a too ambitious goal: automatically removing zombies if I can automatically prove that it is safe, mostly by ensuring that their arguments are not nil. That did not work out. But we can still have something useful if we concede that the resulting code will have to be tested anyway. So `zk -e` is an "eager mode" of the zombie killer which does not care about the arguments possibly being nil, and simply replaces `Ops.add(a, b)` by `a + b` and so on. Here's an example of it in action: https://github.com/yast/yast-installation/pull/761/files Let me know if it helps you (or not). -- Martin Vidner, YaST Team http://en.opensuse.org/User:Mvidner
What are my eyes seeing [1] ! Obviously, it worths trying, we have to get rid of all that zombies that makes the code too difficult. But first, I would try to add unit tests for each file we want to fix. We should be ensure that we are only killing zombies and not simply ugly people :) [1] https://github.com/yast/yast-installation/pull/761/files#diff-d71ded583f464f... On 11/8/18 4:18 PM, Martin Vidner wrote:
Hi,
it was Halloween last week so my mind turned to zombies, in particular those beginning with Yast::Builtins and Yast::Ops.
As you may remember, we have a zombie killer: https://rubygems.org/gems/zombie-killer https://github.com/yast/zombie-killer
Originally I set a too ambitious goal: automatically removing zombies if I can automatically prove that it is safe, mostly by ensuring that their arguments are not nil. That did not work out. But we can still have something useful if we concede that the resulting code will have to be tested anyway.
So `zk -e` is an "eager mode" of the zombie killer which does not care about the arguments possibly being nil, and simply replaces `Ops.add(a, b)` by `a + b` and so on.
Here's an example of it in action: https://github.com/yast/yast-installation/pull/761/files
Let me know if it helps you (or not).
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
participants (2)
-
José Iván López González
-
Martin Vidner