Setting a rule parameter via sonar-project.properties

Hello,

I’m working with a project where the javascript:S107 rule is triggered but refactoring to using “parameter object” does not make much sense, at least in the short term.

The documentation page for that rule tells me the parameter is called maximumFunctionParameters and so I want to change it to 10 as it suits my needs.

For this, I tried modifying the sonar-project.properties file by adding any of the following lines:

sonar.javascript.maximumFunctionParameters=10
sonar.maximumFunctionParameters=10
sonar.maximumFunctionParameters = 10

But to no avail, the default value is still used.
Is this at all possible in the properties file? I have seen a message that says it isn’t but because it’s from 4 years ago, I thought that maybe things have changed in this area.

We are using Developer Edition v2025.1.2 (108896) ACTIVE MQR Mode and this needs to be changed on a single project, not any of the other 100 projects on this server.

I tried finding a reference for the sonar-project.properties file syntax, but could not find any. Maybe there is something to be done within the sonar.issue prefix, but right now I only know about sonar.issue.ignore and I don’t want to ignore the rule, just change its parameter.

Thanks for any suggestion.

Hi,

Sorry, but nothing’s changed on that front. It’s still not possible. You’ll need to update your Quality Profile.

Your best bet is probably to create a child profile that inherits from the main one and edits that rule param.

Another option, of course, is to just Accept the issue.

 
HTH,
Ann

Ah well, that’s too bad.
Thanks for the suggestions, I’ll see what I can do

1 Like