Mailinglist Archive: yast-devel (108 mails)

< Previous Next >
Re: [yast-devel] Yast and Rubocop?
Dne 25.11.2014 v 10:51 Josef Reidinger napsal(a):
[...]
when I see this change
(
https://github.com/yast/yast-registration/commit/3e89195d3938d04c3de39b2a5a911daf4d74fe08#diff-10fd72d29294370773d49226a6b02eefL163
), I am not sure if it helps with readability.
I think better change is to change it to

if ret == :skip && confirm_skipping
log.info "Skipping registration on user request"
@registration_skipped = true
break
end
end

in general I am not sure if it is wrong to use return in loops. What is
rationale behind?

It actually complained because of the extra "if" block.

It's similar to the usual "if" guard clauses:

if something return if !something
do_something ---> do_something
end


The requested change is this:

while foo while foo
if something next if !something
do_something ---> do_something
break break
end end
end

It saves one indentation level.

--

Ladislav Slez√°k
Appliance department / YaST Developer
Lihovarsk√° 1060/12
190 00 Prague 9 / Czech Republic
tel: +420 284 028 960
lslezak@xxxxxxxx
SUSE
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >