Ruby plugin should consider ruby version 2.6

Hi, after running latest rubocop including https://github.com/rubocop-hq/rubocop/pull/7921 I got syntax errors reported by sonarqube for the endless ranges (1…) introduced in ruby 2.6 https://blog.bigbinary.com/2018/07/04/ruby-2-6-adds-endless-range.html

After digging a bit deeper, I found that https://github.com/SonarSource/slang/blob/9edc3b56e3ec9c5e3c4aff2e01079af2c7a3a79f/sonar-ruby-plugin/src/main/resources/whitequark_parser_init.rb#L21 requires the parser for ruby 2.5, that does not support the endless ranges.

This limits the usefulness of sonarqube, if one wants to use new syntax introduced by newer ruby versions. Rubocop itself uses the ruby version defined in .ruby-version file, could that be an option to use the corresponding parser?

Hello @Aqualon,

thanks for reporting this issue, I created ticket in JIRA https://jira.sonarsource.com/browse/SONARSLANG-488 , but I can’t provide any eta when this will get fixed (I hope we would be able to refresh Ruby plugin within next few months)

Hello @saberduck :wave:
I see that the ticket https://jira.sonarsource.com/browse/SONARSLANG-488 marked as closed. Do you know in what SonarQube version I can found these changes?

Hello @DaniilLeksin,

The support of Ruby 2.7 is available from SonarQube 8.6.

By the way, SonarQube 8.7 will introduce the support of Ruby 3.0.

Best,
Quentin

1 Like

Thanks a million @Quentin :bowing_man:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.