Skip to content

Commit 3b63e53

Browse files
authored
Add documentation on how to use coverlet (#85)
1 parent b2ae6fd commit 3b63e53

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ reported a the [GibHub repository](https://github.com/dotnet-project-file-analyz
145145
### Other
146146
* [**Proj1100** Avoid using Moq](rules/Proj1100.md)
147147
* [**Proj1101** Package references should have stable versions](rules/Proj1101.md)
148+
* [**Proj1102** Use Coverlet Collector or MSBuild](rules/Proj1102.md)
148149
* [**Proj1200** Exclude private assets as project file dependency](rules/Proj1200.md)
149150

150151
## Resource file rules

rules/Proj1102.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
parent: Other
3+
ancestor: MSBuild
4+
---
5+
6+
# Proj1102: Use Coverlet Collector or MSBuild
7+
[Coverlet](https://github.com/coverlet-coverage/coverlet) is a cross-platform
8+
code coverage framework for .NET, with support for line, branch and method
9+
coverage. The packages `coverlet.collector` and `coverlet.msbuild` have the
10+
same purpose but should not be used together. Note that `coverlet.collector` is
11+
preferred over the `coverlet.msbuild`.
12+
13+
## Non-compliant
14+
``` xml
15+
<Project Sdk="Microsoft.NET.Sdk">
16+
17+
<PropertyGroup>
18+
<TargetFramework>net8.0</TargetFramework>
19+
</PropertyGroup>
20+
21+
<ItemGroup>
22+
<PackageReference Include="coverlet.collector" PrivateAssets="all" />
23+
<PackageReference Include="coverlet.msbuild" PrivateAssets="all" />
24+
</ItemGroup>
25+
26+
</Project>
27+
```
28+
29+
## Compliant
30+
``` xml
31+
<Project Sdk="Microsoft.NET.Sdk">
32+
33+
<PropertyGroup>
34+
<TargetFramework>net8.0</TargetFramework>
35+
</PropertyGroup>
36+
37+
<ItemGroup>
38+
<PackageReference Include="coverlet.collector" PrivateAssets="all" />
39+
</ItemGroup>
40+
41+
</Project>
42+
```
43+
44+
or
45+
46+
``` xml
47+
<Project Sdk="Microsoft.NET.Sdk">
48+
49+
<PropertyGroup>
50+
<TargetFramework>net8.0</TargetFramework>
51+
</PropertyGroup>
52+
53+
<ItemGroup>
54+
<PackageReference Include="coverlet.msbuild" PrivateAssets="all" />
55+
</ItemGroup>
56+
57+
</Project>
58+
```

0 commit comments

Comments
 (0)