Enable rules that are used for analysing source to be analysed for test

As we in our team would like to maintain code quality for test files, there are lots of rules like cognitive complexity, which can be used to analyse the source files.
Using sonarqube it is difficult for us to improve the quality tests just like source.
Please help us.

Hey there.

While you could force all files to fall under sonar.sources, that’s not the default behavior today. It’s something we plan to work on. You might want to join on this thread: Test classes may have different rules than non-test classes, but not "unused imports"? - #3 by Colin