Ruby 3.1 syntax support


According to this Ruby 3.1 hash syntax not supported with SQScanner which points to SONARSLANG-556 recent scanner versions should support Ruby 3.1 but it doesn’t look like the case.

I am running sonar-scanner- against Ruby 3.1 codebase and it is unable to scan constructions like

  status: status.to_s,
  errors: [{
    status: status.to_s,
  method: :get,
  path: '/exchange',
render json: encode_error(exc, status:), status:

Each ends with (SyntaxError) unexpected token tCOMMA

As well as

def subscribe(*args, &)
  provider_class.subscribe(*args, &)

Which leads to (SyntaxError) unexpected token tRPAREN

So it looks it is not read as this syntax is perfectly valid and passes ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux] syntax checks.

1 Like


What version of SonarQube are you using? You can check the page footer if you’re not sure.



I am using Enterprise Edition Version 8.9.6 (build 50800)


Support for Ruby 3.1 was added in SonarQube 9.6. Note that the current version is 9.7.1, so if you’re going to upgrade, you might as well go all the way.


Oh, okay… I was thinking the scanner should be able to parse it before sending to backend, while the server will either mark them as a “Code Smell” or as an error (which is happening right now) if it doesn’t support.

Good to know that scanner doesn’t play a role here.

Thanks for clarification!

1 Like

Ha, I just realized that the Sonarqube 8.9 is the LTS version. So, upgrade is not without a drawbacks.

Any idea when 9.6+ will be moved to LTS?

8.9 was initially released in May, 21. With a lifecycle of 18 months, the new version should be released this or the next month, isn’t it? :expressionless:


9.6 will never be “moved” to LTS. When we release LTS versions, they are released as LTS. And BTW, the current version is 9.7.1. The LTS is expected in 2023Q1.

Ehm… I’m not sure about drawbacks. It does come with great rewards. Including support of Ruby 3.1. :smiley:


Obviously the upgrade cycle which is every 2 months instead of 18. Also stability and less unexpected changes.

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

Hey @Cuba

SonarQube v9.9 LTS will be released in February! More info here: