How to set sonar.issue.ignore.block in sonar-project.properties

Hello, I’m wondering how I might set the setting sonar.issue.ignore.block in the sonar-project.properties file?

I see from the SonarCloud UI the web form has the name for the block begin and end regex patterns as settings[sonar.issue.ignore.block][beginBlockRegexp] and settings[sonar.issue.ignore.block][endBlockRegexp], but this does not help me understand how to set this value in a .properties file.

Thanks

1 Like

Interesting…

And then there is this

So. I am assuming the docs over here ( https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/#NarrowingtheFocus-IgnoreIssues ) are just not accurate.

Hi @dschnare,

We recommend users to use the UI to configure this, for best experience. Consider the configuration via sonar-project.properties as an undocumented hack, not official supported that may or may not work reliably, use at your own risk.

Cheers,
Janos

Well that’s entirely misleading. The documentation clearly shows properties that can be set in a project analysis configuration file. Shouldn’t the documentation for SonarCloud reflect that the project configuration files are a hack or not even mention them then?

Is the sonar-project.properties file being deprecated for SonarCloud projects?

https://sonarcloud.io/documentation/analysis/analysis-parameters/

For anyone using project configuration files:

sonar.issue.ignore.allfile=e1
sonar.issue.ignore.allfile.e1.fileRegexp=@sonar-disable
sonar.issue.ignore.block=e2
sonar.issue.ignore.block.e2.beginBlockRegexp=@sonar-ignore
sonar.issue.ignore.block.e2.endBlockRegexp=@end

Are examples of how to set sonar.issue.ignore.allfile and sonar.issue.ignore.block.

You linked to the Analysis Parameters page, which doesn’t mention the sonar.issue.ignore.* properties, because this is not something we want to support. Consistent with that, the Narrowing the Focus page clearly says that the multi-value properties can only be set by the web interface. And again, it doesn’t mention the sonar.issue.ignore.* property names.

So I don’t see what is misleading here. The bottom line seems simple:

Do let me know what I’m missing.

Not for the moment.

Ah fair enough. Too bad the sonar-project.properties file doesn’t have parity with what can be set in the UI, it would have made it a great option to configure your project settings.

1 Like