Activate rule for a specific maven module

Hi,

We have a maven multimodule project. One module contains regression tests. And for this module we want to apply a rule that checks that all test cases has the package regression. Is it possible to apply one rule to a specific module?

br,

//mike

Hi Mikael,

I think the analysis property sonar.issue.enforce.multicriteria would meet this need well. It will allow you to restrict the enforcement of the rule down to just some files/directories, in which you can specify a pattern that matches only the files in your desired module.

The same property can be found in the UI under Project Settings / General / Analysis Scope at the bottom of the page.

Thanks Jeff!

I will try it out and see if we can use on a couple of modules for our maven multimodule project in SQ.

Will let you know here.

//mike

I used the provided suggestion:

Administration --> General Settings --> Analysis Scope and then go all the way to the end of page and to: Restrict Scope of Coding Rules

We ended up with:

Rule Key PatternPattern: ( to match rules which should be ignored.)

java-prod-custom-rules:RegressionPackageNameCheck

File Path Pattern: (Pattern to match files which should be ignored.)

^((?!prod-regression-tests).)*$

Thanks @Jeff_Zapotoczny!

//mike

Glad it helped!!