forked from dotnet/format
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request dotnet#722 from JoeRobich/update-docs
Update documentation for analyzers
- Loading branch information
Showing
20 changed files
with
208 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# 3rd Party Analyzers | ||
|
||
## How to add analyzers to a project | ||
|
||
3rd party analyzers are discovered from the `<PackageReferences>` specified in the workspace project files. | ||
|
||
*Example:* | ||
|
||
Add the StyleCop analyzer package to a simple console project file. | ||
|
||
```diff | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
+ <ItemGroup> | ||
+ <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" /> | ||
+ </ItemGroup> | ||
|
||
</Project> | ||
``` | ||
|
||
## How to configure analyzer severity | ||
|
||
The options specified in .editorconfig files are recognized by the pattern `dotnet_diagnostic.<diagnostic-id>.severity = <value>`. `<diagnostic-id>` represents the diagnostic ID matched by the compiler, case-insensitively, to be configured. `<value>` must be one of the following: error, warn, info, hidden, suppress. | ||
|
||
*Example:* | ||
|
||
Configure the StyleCop analyzer so that empty comments are errors. | ||
|
||
```ini | ||
[*.{cs,vb}] | ||
|
||
# The C# comment does not contain any comment text. | ||
dotnet_diagnostic.SA1120.severity = error | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.