RubyMine 6 + Ruby syntax

Hi there,
I'm a relatively new user to ruby and ruby mine.

I was wondering weather or not there was an easy way to default my ruby mine to not tell me about syntax errors when  in fact they are not errors (or warnings)
eg
def initialize arg1, arg2
...
end

You don't need parentheses around the arguments yet ruby mine tells me that I should have them. There are a few similar things that ruby mine complains about and I find myself not using the editor because it keeps telling me im not doing it correctly when in some situations I am. :(

Would I need to turn off each one of these warnings for syntax 'error' when in fact its perfectly valid ruby.

another example is a line like this
before { Date.stub(:today).and_return(Date.parse('2013-12-01')) }
the Date.stub(:today) is flagged as an error because it believes it should take more arguments when its optional.

any tips or advice would be appreciated.

Thanks

4 comments
Comment actions Permalink

Hi,

> I was wondering weather or not there was an easy way to default my ruby mine to not tell me about syntax errors when  in fact they are not errors (or warnings)
> eg
> def initialize arg1, arg2
> ...
> end
>  
> You don't need parentheses around the arguments yet ruby mine tells me that I should have them. There are a few similar things that ruby mine complains about and I find myself not using the editor because it keeps telling me im not doing it
> correctly when in some situations I am. :(
>
> Would I need to turn off each one of these warnings for syntax 'error' when in fact its perfectly valid ruby.

It is "Parentheses around arguments" inspection you can disable it Settings|Inspections|Ruby|"Parentheses around arguments" but be aware that ruby style guide recommends to wrap arguments in parentheses (https://github.com/bbatsov/ruby-style-guide#syntax).

> another example is a line like this
> before { Date.stub(:today).and_return(Date.parse('2013-12-01')) }
> the Date.stub(:today) is flagged as an error because it believes it should take more arguments when its optional.

it looks like a bug :(  Can yu provide a simple project which demonstrates the problem?

Regards, Oleg.

0
Comment actions Permalink

Hi thanks for the reply,

I'll see if I can throw up an example over the weekend to demonstrate the bug.
But at a quick inspection the stub def looks like this

def stub name, val_or_callable, &block
...
...
end


but I'm only passing in 1 arg the name. and Ruby mine flags this as an error saying it needs more. Yet it runs fine.

Thanks, ill update once I get an example you can check out.

0
Comment actions Permalink

Ok so I dug a little deeper into this issue and I think its just an issue with the project im using.

Im using rspec and the stub method is being resolved to the minitest gem (which is being included via another gem).
So when I run the app with rspec it runs fine. (I think because rspec is being required at runtime)

So ignore this post, I may have been a little presumptious.

Thanks very much

0
Comment actions Permalink

I'm having the same issue. At  least the same sympthoms.

Did you solve it somehow?

0

Please sign in to leave a comment.