Install
dotnet add package Faithlife.Analyzers --version 1.6.2
| Product | Versions |
|---|---|
| .NET Standard |
README
Faithlife.Analyzers
Roslyn-based C# code analyzers used on Faithlife source code.
How to Use
Use PackageReference in your .csproj:
<ItemGroup>
<PackageReference Include="Faithlife.Analyzers" Version="1.2.0" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
</ItemGroup>
To disable a particular analzyer, add a line to your .editorconfig under [*.cs]. For example:
[*.cs]
dotnet_diagnostic.FL0009.severity = none
Analyzers
| ID | Description |
|---|---|
| FL0001 | AsyncWorkItem.Current must only be used in methods that return IEnumerable<AsyncAction> |
| FL0002 | Optional StringComparison arguments must always be specified |
| FL0003 | UntilCanceled() may only be used in methods that return IEnumerable<AsyncAction> |
| FL0004 | Use operator== or a non-ordinal StringComparison |
| FL0005 | Avoid ToReadOnlyCollection in constructors |
| FL0006 | Optional IComparer<string> arguments must always be specified |
| FL0007 | Avoid $ in interpolated strings |
| FL0008 | WorkState.None and WorkState.ToDo must not be used when an IWorkState is available |
| FL0009 | Prefer "" over string.Empty |
| FL0010 | Prefer modern language features over IfNotNull |
| FL0011 | GetOrAddValue should not be used with ConcurrentDictionary |
| FL0012 | DbConnector.Command should not be used with an interpolated string |
| FL0013 | Do not use Uri.ToString() |
| FL0014 | Interpolated strings should not be used without interpolation |
| FL0015 | Prefer null-conditional operators over ternaries |
| FL0016 | Verbatim strings should only be used with certain special characters |
| FL0017 | Do not use a switch expression on a constant value |
| FL0018 | Prefer string interpolation over FormatInvariant |
| FL0019 | Local Functions as Event Handlers |
| FL0020 | Lambda Expressions as Event Handlers |
| FL0021 | Use null propagation |
| FL0022 | Use AsyncMethodContext.WorkState |
| FL0023 | Replace obsolete Logos.Common.Logging.Extensions extension methods |
How to Help
- Improve the documentation in the docs/ directory, especially by adding rationale for rules or instructions for how to choose between multiple fixes.
- Suggest new analyzers by opening an issue. Please add the
new analyzerlabel. - Vote for analyzers you would find particularly helpful by adding a 👍 reaction.
- Implement a new analyzer from this list of the most popular.
Changes from Previous Version
No structural changes between v1.6.1 and v1.6.2.
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Compatibility metadata lists 1 target framework; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.