0

The defs defined in spock such as def "Login and Move to checkout page"(){ }

SonarQube considered it as groovy method and shows as bug that the method name should start with small l and not capital L [Login and Move....}

Could you please somebody help in customize sonar rule so that it ignores spock method

2 Answers 2

0

If it is not required on your project you may exclude Spock tests from Sonar analyzing at all:

sonar.exclusions=src/test/*.groovy

Otherwise you should probably find the corresponding rule and change the default regular expression, e.g. ^[a-zA-Z0-9]+$. But I am not sure you can do this specifically only for groovy test files.

0

I have configured the Sonarqube to ignore Sonar's rule "Method name" for folder where Geb spock scripts are present

It works fine

To know how to configure,follow below steps:

1.Goto Administration tab->Analysis Scope->Issues
2.There , you will find "Ignore Issues on Multiple Criteria".
3.Provide Rule ID in "Rule Key pattern" textbox [Rule ID can be found by clicking on the particular rule and find it in top right
corner]
4.Provide Filepath for which you need to ignore rule in "File Path Pattern" textbox
5.Click on Save Issues settings

Refer below images to know where to see the rule name and where to configure the path Image to know where Rule ID will be present in the page Image where Rule key pattern and File Key pattern text boxes are present

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.