Skip to content

Commit

Permalink
Reintroduce the dotnet-cover config to include the ExcludeFromCodeCov…
Browse files Browse the repository at this point in the history
…erageAttribute
  • Loading branch information
killij committed Dec 18, 2023
1 parent c0ce33e commit 8508ba8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@
/d:sonar.token="${{ secrets.SONAR_TOKEN }}" \
/d:sonar.host.url="https://sonarcloud.io"
dotnet build --no-incremental
dotnet-coverage collect -f xml -o coverage.xml "dotnet test"
dotnet-coverage collect --settings dotnet-cover-config.xml -f xml -o coverage.xml "dotnet test"
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
5 changes: 4 additions & 1 deletion Childrens-Social-Care-CPD/Search/CpdDocument.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Childrens_Social_Care_CPD.Search;
using System.Diagnostics.CodeAnalysis;

namespace Childrens_Social_Care_CPD.Search;

[ExcludeFromCodeCoverage]
public partial class CpdDocument
{
public string Id { get; set; }
Expand Down
20 changes: 20 additions & 0 deletions dotnet-cover-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
<CodeCoverage>

<Attributes>
<Exclude>
<Attribute>^System\.Diagnostics\.DebuggerHiddenAttribute$</Attribute>
<Attribute>^System\.Diagnostics\.DebuggerNonUserCodeAttribute$</Attribute>
<Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute>
<Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute>
</Exclude>
</Attributes>

<CompanyNames>
<Exclude>
<CompanyName>.*microsoft.*</CompanyName>
</Exclude>
</CompanyNames>
</CodeCoverage>
</Configuration>

0 comments on commit 8508ba8

Please sign in to comment.