RubyMine highlights some lines of newly created work projects as errors

I'm new to Ruby on Rails, and when I came from the Java world and worked in IntelliJ Idea, I stared at using RubyMine to develop RoR.

I created a new project and opened it in RubyMine. Everything compiles and works fine, but RubyMine highlights some lines as errors (but actually there are no errors).

For example, the code from application_controller.rb

protect_from_forgery with: :exception 

The semicolon after 'with' is highlighted as an error, and hind says: "Expected :; or end of line

Similar errors associated with errors in many places in the project

I think there may be some problems with different versions of Ruby and Rails? Or do RubyMine not support some new syntax?

ruby 2.0.0p247 (printable version 2013-06-27 41674) [universal.x86_64-darwin13]

Rails 4.0.1

+6
source share
2 answers

RubyMine 5 could not run with: and RubyMine 6 could.

The main tip: if you come from Java-land, you will find that static analysis of dynamic languages ​​is a hit or skip. (This should not be, for http://www.oreillynet.com/onlamp/blog/2008/05/dynamic_languages_vs_editors.html , but it is!) You will learn how to ignore some of the details that RubyMine complains about.

For example, you should prefer 'single quotes' without the urgent technical need for "double quotes" . But tests should use literal double-quoted strings, for example scenario "I do not like RubyMine lint" do . This is just a edit from scenario "I don't like RubyMine lint" do , so all such literate strings should start with double quotes. But RubyMine dutifully notes them.

+3
source

With later versions of RubyMine on Mac:

Go to Settings β†’ "Language and Frames" β†’ "Ruby SDK and Gems" and change to Ruby 2.0 SDK

Reboot and it should work

0
source

Source: https://habr.com/ru/post/958882/


All Articles