Hi, A solution I’m analysing in SonarCloud via Azure Pipelines is showing code smells in the test p

Hi,

A solution I’m analysing in SonarCloud via Azure Yaml Pipelines is showing code smells in the test projects. I would like to prevent code smells in test projects being analyzed but I can’t seem to prevent it.

I tried sonar.exclusions AND sonar.test.exclusions in yaml pipeline.

The task used is:

  - task: SonarQubePrepare@6
  inputs:
    SonarQube: 'taxprepwebsonarqube'
    scannerMode: 'MSBuild'
    projectKey: '{projectKey}'
    projectName: '{projectKey}'
    projectVersion: '$(Build.BuildNumber)'
    extraProperties: |
      sonar.verbose=true  
      sonar.exclusions=**/Startup.cs,**/Program.cs
      sonar.test.exclusions=**/<customfolder>/Tests/**          
      sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)\**\*.trx

Thanks

Hi,

Welcome to the community!

My first question to you is whether these projects/files are recognized as tests or analyzed as source files.

The easiest way to tell is to see whether a Lines of Code measure shows up for them on the Code page:

We don’t count Lines of Code for tests, so if you have a - there, then they’re recognized as tests.

 
Ann