Rubocop is the best code analyst =)

On Nov 19, 2016 18:18, "Nathan Guilty" <ruby / e-solutions.re> wrote:

> Ok, i'm looking also for best practice.
> Do you know a better code analyst ?
>
> Thank you very much.
>
> /Nathan
>
> Le 2016-11-19 19:13, thomas Perkins a crit :
>
>> Rubocop is just a style analyst. Your code will work, it's just
>> contradicting ruby style guide
>>
>> - Thomas Perkins
>>
>> On Nov 19, 2016, at 9:01 AM, Nathan Guilty <ruby / e-solutions.re> wrote:
>>>
>>> Hi,
>>>
>>> I have the following issues(2) :
>>>
>>>
>>> ***ISSUE 1
>>> lib/core.rb:83:5: C: Use a guard clause instead of wrapping the code
>>> inside a conditional expression.
>>>    if turn.to_i == @num
>>>    ^^
>>>
>>> # piece of code
>>> def a_winner?(turn)
>>>  if turn.to_i == @num
>>>    @try == 1 ? big_winner : winner
>>>  end
>>> end
>>>
>>> Any idea ?
>>>
>>>
>>> ***ISSUE 2
>>> lib/core.rb:95:7: C: Don't use parentheses around a method call.
>>>      (Show.warn_number; redo) unless a_number?(turn)
>>>      ^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>> Why it is a problem ?
>>>
>>>
>>> Thank you very much for your help.
>>>
>>> /Nathan
>>>
>>>
>>> Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org
>>> ?subject=unsubscribe>
>>> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
>>>
>>
> Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
>
(supressed text/html)
Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>