However, in the metrics documentation I can’t find the test code specific metrics alluded to in the paragraph.
What leads to these questions is the documented example where they have both sonar.exclusion and sonar.test.inclusions doesn’t show any test code metric I can find in the Sonar Cloud UI and therefore to me feels no different than just applying sonar.exclusion only.
I believe there is a nuance that I am not understanding and I hope someone can help explain. Thanks
We don’t calculate a lot of test-related metrics. In fact, by default, our “calculation” consists of making sure tests are excluded from the normal metrics (E.G. Lines of Code, Complexity &etc.). The test-related metrics we do have come straight from test execution reports, if you choose to feed them into analysis.
Distinguishing test files from source files is less about calculating test metrics and more about
a) excluding tests from code-related metrics, including LOC, against which licensing is charged
b) executing the right rules against the files. For instance, it makes no sense to run strict taint-analysis rules against tests, when they’re never going to take user input in production.
Thanks for the response. Based on what you described, I can get the same result by using sonar.exclusion vs sonar.test.inclusions especially if I do not want to not see my test code show up in the tree view of the Code tab.