Skip to content

Commit 14fb52b

Browse files
authored
Microsoft.Extensions.StaticAnalysis Readme (#4594)
* Fill in the readme * -ruleset
1 parent 02c8641 commit 14fb52b

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed

src/Packages/Microsoft.Extensions.StaticAnalysis/Microsoft.Extensions.StaticAnalysis.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<PackageId>Microsoft.Extensions.StaticAnalysis</PackageId>
4-
<Description>Curated set of code analyzers and code analyzer settings.</Description>
4+
<Description>A curated set of code analyzers and code analyzer settings.</Description>
55
<Workstream>Fundamentals</Workstream>
66
<Category>Static Analysis</Category>
77
</PropertyGroup>
Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,52 @@
1-
README
1+
# Microsoft.Extensions.StaticAnalysis
2+
3+
A curated set of code analyzers and code analyzer settings.
4+
5+
## Install the package
6+
7+
From the command-line:
8+
9+
```dotnetcli
10+
dotnet add package Microsoft.Extensions.StaticAnalysis
11+
```
12+
13+
Or directly in the C# project file:
14+
15+
```xml
16+
<ItemGroup>
17+
<PackageReference Include="Microsoft.Extensions.StaticAnalysis" Version="[CURRENTVERSION]" >
18+
<PrivateAssets>all</PrivateAssets>
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20+
</PackageReference>
21+
</ItemGroup>
22+
```
23+
24+
## Usage Example
25+
26+
On install, a warning will be displayed that `The StaticAnalysisCodeType property is not defined, assuming 'General'`. The General set of diagnostics is enabled by default. To select a different set of diagnostics (or hide the warning) add the `StaticAnalysisCodeType` property to your project as follows.
27+
28+
```XML
29+
<PropertyGroup>
30+
<StaticAnalysisCodeType>General</StaticAnalysisCodeType>
31+
</PropertyGroup>
32+
```
33+
34+
## Available Sets Of Diagnostics
35+
36+
Different pre-defined sets of diagnostics are available depending on the type of project being built. These can be specified in the StaticAnalysisCodeType property:
37+
- Benchmark: Projects used for benchmarking.
38+
- General: Any type of project.
39+
- NonProdExe: Projects that produce an exe for non-production use.
40+
- NonProdLib: Projects that produce a library (dll) for non-production use.
41+
- ProdExe: Projects that produce an exe for production use.
42+
- ProdLib: Projects that produce a library (dll) for production use.
43+
- Test: Projects used for testing.
44+
45+
Each of these also has an optional `-Tier1` and a `-Tier2` variant (e.g. `General-Tier1`).
46+
- `Tier1` enables only the most important diagnostics from this set.
47+
- `Tier2` includes Tier1 diagnostics and others that aren't as critical.
48+
- The names without `Tier` suffixes include all diagnostics from tier's 1 and 2, and any others that are applicable.
49+
50+
## Feedback & Contributing
51+
52+
We welcome feedback and contributions in [our GitHub repo](https://github.com/dotnet/extensions).

0 commit comments

Comments
 (0)