Analyze code in test projects

We have a central test automation framework written in C#. This solution contains only tests and common utilities to support tests across multiple projects. We’d like to scan our test automation framework to adhere to the same C# coding rules as our production code. When we scan the code in a long-living branch, SonarCloud reports “The main branch has no lines of code.” When reviewing the analysis logs, 38 files are indexed but they are picked up as ‘tests’ rather than ‘source’. Is it possible to scan test projects against a quality profile?

From the analysis logs:
Indexing files of module ‘Common’
INFO: Base dir: /home/vsts/work/1/s/Common
INFO: Test paths: Constants/TestCategory.cs, Imaging/DifferenceImaging.cs, Seleni…
INFO: Included sources: **/*.cs
INFO: Excluded sources: /build/, /deploy/
INFO: Excluded sources for coverage: /build/, /deploy/

**CI system: ** Azure DevOps
**Scanner: ** Scanner for MSBuild


You can either try to put this setting in your tests csprojs


Or you can use the scanner CLI directly, by providing manually the sources to analyze :