How to set default config values not present in the admin UI

I am running Sonarqube 8.2.0.32929 on a Kubernetes cluster and things generally work fine.

I was just wondering how I can set defaults for config values that are not present in the UI. I do a lot of Python analysis and the CI pipeline includes a flake8 step. When I push the results to Sonarqube, I can manually add -Dsonar.python.flake8.reportPaths=flake8.txt and that works fine. However, for xunit tests and coverage output, I can specify default paths in the admin UI, which I would much prefer here.

I also analyse a bunch of other languages and I would much prefer to have a single Sonarqube CI step that doesn’t have a whole bunch of language-specific params in it.

Is it possible to somehow set a default value for sonar.python.flake8.reportPaths? Or for any setting not present in the UI?

Thanks!

Hi Gerard, welcome to the SonarSource Community!

If you can’t find a place to set such a value in the admin UI and don’t want to pass it on the command line, another option to consider is to specify it in a sonar-project.properties file and check that in to the root project folder.

Hi Jeff,

Thanks for the quick follow-up and good to be here :slight_smile:

I’ve been using Sonarqube for quite some time now, so I’m aware of how to pass stuff via the command line and in sonar-project.properties. I was just hoping I could set defaults for everything on the server-side, perhaps in some hidden section of the admin panel, or even by directly setting them in the database.

The problem here is that we use a bunch of centralized CI pipelines that are managed by devops engineers. We have 1 job to push things to Sonarqube. Ideally I can keep just that 1 job, regardless of the language in use. I also don’t want developers to be able to mess with the Sonarqube settings, so using sonar-project.properties is not a good approach for us.

Since xunit and coverage outputs have defaults, we can just make sure that the files we generate end up where the defaults expect them - or even change the defaults if we want it elsewhere. For flake8 and pylint etc., this is not possible; there are no defined defaults and we cannot set these particular settings via the admin.

I wonder if this is by design (if so; why? Why settable xunit and cov, but not the rest?), or if it’s an oversight (if so; will this be fixed at some point?).

I have inserted a property for sonar.python.flake8.reportPaths directly into the database into the properties table and this works!, so it’s clearly possible, but it’s not exactly a manageable way of dealing with things, especially with repeatable deployments.