Dne 02. 01. 19 v 10:17 Lukas Ocilka napsal(a):
> Dne 21. 12. 18 v 15:41 Lukas Ocilka napsal(a):
>> C. If it's a "sigh" one, then ... ?
> 
> With the happy new year 2019 I realized that it must have been this one :) 
> All 
> languages are weird. Including all spoken languages too.
> 
>> So, what can we actually learn from this? What can we do better?
> 
> This part is still pending. I myself don't know.


Always use some additional checks: unit tests, rubocop or at least the
syntax check with "ruby -wc". But be careful, the syntax check just prints a 
warning
and does not fail so do not relay on that in automatic checks (Travis), on the 
other
hand Rubocop fails by default.

And the Rubocop's message is a bit more understandable:

Offenses:

weird.rb:17:14: W: Ambiguous positive number operator. Parenthesize the method
arguments if it's surely a positive number operator, or add a whitespace to the 
right
of the + if it should be a addition.
    puts foo +"bar"
             ^


BTW a similar issue also exists in the other languages, some time ago I did a 
stupid
typo in a shell script:

$ARGS=""

The BASH syntax check ("bash -n") does not print any warning, you have to use 
the
shellcheck to really find it:

$ARGS=""
 ^-- SC1066: Don't use $ on the left side of assignments.


Which reminds me I have written a draft email for the shellcheck announcement, 
I'll
post it here...


And just few minutes ago Martin found a syntax error in a Perl code which could 
have
been found by "perl -wc". So we should really add some more automatic checks...



-- 
Ladislav Slezák
YaST Developer

SUSE LINUX, s.r.o.
Corso IIa
Křižíkova 148/34
18600 Praha 8
-- 
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to