MicrosoftPremier / VstsExtensions

Documentation and issue tracking for Microsoft Premier Services Visual Studio Team Services Extensions
MIT License
56 stars 14 forks source link

failed a CI is there are any warning #200

Closed smarteez17 closed 1 year ago

smarteez17 commented 1 year ago

Hi, there I have been tasked to fail any CI pipeline if there are any warnings. I using this code and only getting "Waiting for code coverage data ... " ( i am not sure if the steps are correct too ) . Please help

In my code there 180 warning after I build the api

ReneSchumacher commented 1 year ago

Hi @smarteez17,

the simplest way to reach your goal is to treat warnings as errors. The compiler should have an option for this (e.g., see https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/errors-warnings). Your pipeline will then always fail if there are any warnings.

If you want to fail only when a certain number of warnings is exceeded or when the number of warnings increased, you can use the BuildQualityChecks task like this:

Fixed threshold:

- task: BuildQualityChecks@8
  displayName: 'Check warnings'
  inputs:
    checkWarnings: true
    warningFailOption: fixed
    warningThreshold: <your threshold>

Increasing number of warnings:

- task: BuildQualityChecks@8
  displayName: 'Check warnings'
  inputs:
    checkWarnings: true

Hope that helps.

ReneSchumacher commented 1 year ago

Hi @smarteez17,

have you been able to resolve your issue? I'm closing it for now since there was no feedback for almost two months now. If you still need help, please feel free to add another comment here or open a new issue.

Thanks, René