Ruby 3.1 syntax support

Hi!

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-4.7.0.2747-linux against Ruby 3.1 codebase and it is unable to scan constructions like

::ActiveSupport::JSON.encode({
  status: status.to_s,
  errors: [{
    status: status.to_s,
    title:,
    detail:,
  }]
})
response_from_auth_service(
  method: :get,
  path: '/exchange',
  headers:,
  cookie:
)
render json: encode_error(exc, status:), status:

Each ends with (SyntaxError) unexpected token tCOMMA

As well as

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

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

Hi,

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

 
Ann

Hi,

I am using Enterprise Edition Version 8.9.6 (build 50800)

Hi,

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.

 
:smiley:
Ann

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:

Hi,

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:

 
Ann

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: