Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "(...) interpreted as grouped expression" mean?

Tags:

I'm using a Ruby linter in Atom and for some lines it gives the following warning:

(...) interpreted as grouped expression

An example of a line that get's this warning is this:

elsif not (params[:vacancy].nil? or params[:vacancy]['company_id'].nil? or params[:vacancy]['company_id'] == "0" )

How should that line be improved to make the warning go away?

like image 529
Jasper Kennis Avatar asked Jun 25 '15 09:06

Jasper Kennis


2 Answers

The warning is

(...) interpreted as grouped expression

And it means exactly what it says: in Ruby, parentheses can be used for three purposes, expression grouping, parameter lists and argument lists. This warning is emitted when Ruby thinks that you want an argument list but wrote a grouped expression instead. The most common cause is whitespace between the name of the message and the argument list in a message send like this:

foo.bar (1, 2)

This will be interpreted not as an argument list for the message send, but rather a grouped expression, which, in this particular case, is a SyntaxError.

In your particular case, the warning seems to be a false positive.

like image 142
Jörg W Mittag Avatar answered Oct 13 '22 22:10

Jörg W Mittag


Try to Remove the space between not and the parenthesis

like image 32
Mourad Avatar answered Oct 13 '22 23:10

Mourad