Extend configuration from server in Plugin - sonarqube

We have a SonarQube-Server and locally in my Eclipse I have installed SonarQube-Plugin.
In my (local) Project I have a package, which I want to exclude from SonarQube-Analyze.
Therefore I added to the "Preview Analysis Proberties" in Eclipse the "sonar.exlusions"-Property.
This works well, BUT setting this property overrides the property set on the SonarQube-Server.
I do not want to overwrite it, I just want to extend it.
For example, the rule on the SonarQube-Server is "**/aUselessPackage/**/*" and my local rule is "**/myPackage/**/*". When I set this rule, "aUselessPackage" will be analyzed, because I overwrite the Server-property, but I want to exclude "**/aUselessPackage/**/*,**/myPackage/**/*".

Related

Where is the site.vm of the maven-default-skin?

When I run mvn site with no site.xml on a simple Maven project (meaning it will use the maven-default-skin) which site.vm file site used?
I have looked into maven-site-plugin, maven-project-info-reports-plugin, maven-doxia-sitetools and of course maven-default-skin, but I could not find it anywhere.
For the maven-fluido-skin, I can find the site.vm in src/main/resources/META-INF/maven. But there is no such file for maven-default-skin.
When using maven-site-plugin 4.0.0-M3, the maven-doxia-sitetools version used is 2.0.0-M3. This version provides the default-site.vm file in its resources, which is used as the default template in the DefaultSiteRenderer class if the skin doesn't provide any (e.g. maven-default-skin).
In maven-site-plugin 4.0.0-M4, the version of maven-doxia-sitetools is 2.0.0-M4. In this version, the default-site.vm has been removed and the default skin has been changed to maven-fluido-skin.
This means it's not possible anymore to use a skin that doesn't provide the site.vm template. If one tries to force the use of the maven-default-skin with version 4.0.0-M4, it will fail with the message Skin does not contain template at META-INF/maven/site.vm.
This change has been done in https://issues.apache.org/jira/browse/DOXIASITETOOLS-270. maven-default-skin is unmaintained and will be replaced by maven-fluido-skin, see https://issues.apache.org/jira/browse/MSKINS-196.
For information, the site.vm is a Velocity template file and is rendered by maven-doxia-sitetools (doxia-site-renderer to be precise) on maven-site-plugin's request.

How to add prefix in URI while loading XQuery file using ml-gradle

I am using gradle 6.8 and MarkLogic version is 10.0-5.2,
My XQuery code is in directory \ml-gradle\src\main\common. When I run the command mlLoadModules to load XQuery into the modules database it loads with default URI /common/test.xqy.
I want to add some prefix to the URIs e.g. /rsc/common/test.xqy. How can I achieve that?
Note: I don't want to create an extra folder in my source for prefix "rsc".
It's not supported, though you could write a custom Gradle task to change the URI to whatever you like.
Why do you not want to create an "rsc" folder above "common"? I think other developers would find it much more intuitive that "rsc/common/test.xqy" becomes "/rsc/common/test.xqy" when loaded, rather than "common/test.xqy" becomes "rsc/common/test.xqy", which begs the question - where is "rsc" coming from? And then that developer would need to understand what property / custom code is adding that "rsc".

Teamcity build trigger exclude all but some

I'm using teamcity to perform my builds.
within my repository there are multiple projects that uses different folders. e.g. like this:
└root
├project1
│ └files
├project2
│ └files
└project3
└files
I have 3 lanes that should all here just on there own folder.
The current trigger configuration for project2 looks like this:
-:*/project1/*
-:*/project3/*
+:*/project2/*
but I don't want to explicit add all projects to the trigger configuration of every project. therefore I would like to say s.th. like
-:IGNORE_EVERYTHING
+:*/project2/*
which means I just want to list the folder that SHOULD get monitored but not exclude all others. When I just use the last line of the above the two other folders gets monitored as well.
How do I do that?
According to documentation Configuring VCS Triggers:
When entering rules, please note that as soon as you enter any "+" rule, TeamCity will remove the default "include all" setting. To include all the files, use "+:." rule.
You don't need any exclusion rule. Just insert:
+:*/project2/*
in Trigger Rules and you should be good.

Apply custom permission template automatically for sonarqube new project report using sonar-runner

How to configure sonar.projectKey under sonar-project.properties so that we can get apply custom permission template for new project report automatically.
Does anyone try that?
I was trying all type of combination with project key in sonarqube permission template and sonar-runner properties file. But couldn't achieve the result.
Does sonar permission template really support this from sonar-runner.
Below are screenshot attached to the link for my use case:
I have created mfg-desktop permission template and there is also present a default template provided by sonar
When I checked under project permission, I found that default permission template is getting applied in each time
There's nothing to do on the sonar-project.properties side.
As described in the docs, set up your permission template with a project key pattern regular expression. All new projects with keys that match the regex will have that permission template applied.
For example, if in the "Manufacturing Group" template I set my Project Key Pattern to:
mfg-*
and analyze a new project with a key of mfg-extrusion, then the "Manufacturing Group" template will be applied. And when I analyze front-office-billing for the first time, it will not.
Create a new permission Template and assign the regex to the Project Key Pattern.
For example:
Regex :
(prod)-\w+
It will apply the template to the new projects created with Project Key starting with 'prod-'. Sonar needs the key of the new projects to 'fully' match the regex of the permission template key. Using * might not work.
Then link the desired permissions of the users/group on the template. Also make sure the Global Permissions for the users/group are also set appropriately else permissions wont work.
Additional Info: All projects will still be visible to all users. Make your project 'Private' to make it visible only to the required group.
This works on CE v7.6

remove/delete existing from sonarqube

I am new to sonarqube and was able diable/deactivate default rules that comes with sonar. However I would like to know if there is a way to delete/remove default rules from sonar ?
yes of course you can disable some rules and change the level (major, minor etc) in the admin console of your sonarqube and you can use a custom quality profile with a selected rules to analyse you project
http://docs.sonarqube.org/plugins/servlet/mobile#content/view/6964603
Log in as Admin.
Through Quality profile we will be able to activate and deactivate the default rules.
3.Ability to create a new profile with specific rules and scan the project with this new profile.
The following worked for me:
Log in as admin
Set another profile as default, i.e. not the one you want to remove.
Now the non-default profile will be deletable.

Resources