Le 20/11/2014 01:38, Dan Duvall a écrit :
> Ironically enough, it has failed the Travis CI check because of an
> overzealous `GuardClause` check. (Seriously, who can't read an `if`
> statement ... :)

http://www.rubydoc.info/github/bbatsov/rubocop/Rubocop/Cop/Style/GuardClause

Well, one could name it early return.  That saves a level of indentation
and make it obvious that on that condition nothing else is executed.
Else you have to browse down at the end of the condition to look at
potentially additional code.

In php I definitely prefers:

 if ( ! $cond ) {
   return;
 }
 // lot of code

Against:

 if ( $cond ) {
   // lot of code
 }

But yeah might be overzealous :]


-- 
Antoine "hashar" Musso


_______________________________________________
QA mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/qa

Reply via email to