Posseth.NamedArguments.AnalyzerAndFixer
1.0.1.1
See the version list below for details.
dotnet add package Posseth.NamedArguments.AnalyzerAndFixer --version 1.0.1.1
NuGet\Install-Package Posseth.NamedArguments.AnalyzerAndFixer -Version 1.0.1.1
<PackageReference Include="Posseth.NamedArguments.AnalyzerAndFixer" Version="1.0.1.1"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Posseth.NamedArguments.AnalyzerAndFixer" Version="1.0.1.1" />
<PackageReference Include="Posseth.NamedArguments.AnalyzerAndFixer"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Posseth.NamedArguments.AnalyzerAndFixer --version 1.0.1.1
#r "nuget: Posseth.NamedArguments.AnalyzerAndFixer, 1.0.1.1"
#:package Posseth.NamedArguments.AnalyzerAndFixer@1.0.1.1
#addin nuget:?package=Posseth.NamedArguments.AnalyzerAndFixer&version=1.0.1.1
#tool nuget:?package=Posseth.NamedArguments.AnalyzerAndFixer&version=1.0.1.1
Posseth NamedArguments AnalyzerAndFixer
This is a tool that can be used to analyze and fix named arguments in codebase. It is implemented as a Analyzer and CodeFix provider for Roslyn.
Installation
There should be a NuGet package available for this project.
configuration
<b>How to Configure Settings for NamedArgumentsAnalyzer</b>
OnlyForRecords is a boolean ExcludedMethodNames is a comma-separated list of method names yu want to exclude from the analyzer.
the following list of method names are excluded by default:Where, Select, FirstOrDefault, First, Any, OrderBy, OrderByDescending, GroupBy, ToList, ToArray, Contains, ElementAt, ElementAtOrDefault,IsNullOrEmpty, IsNullOrWhiteSpace
You can configure the OnlyForRecords and ExcludedMethodNames settings using an .editorconfig file. Here's how to do it:
Option 1: Using .editorconfig File
- Create or open an .editorconfig file in the root of your solution or project.
- Add the following configuration entries:
# Named Arguments Analyzer Configuration
[*.{cs,vb}]
# Configure OnlyForRecords option
dotnet_diagnostic.PNA1000.OnlyForRecords = true # or false
# Configure ExcludedMethodNames option
dotnet_diagnostic.PNA1000.ExcludedMethodNames = ToString,Equals,GetHashCode
Option 2: Configure in Visual Studio
- Right-click on your solution in Solution Explorer
- Select Analyze > Configure Code Analysis > For Solution
- In the dialog that appears, find your analyzer (PNA1000)
- Configure the settings for OnlyForRecords and ExcludedMethodNames
Option 3: Configure in Project File (.csproj) You can also add these settings to your project file:
<PropertyGroup>
<AnalysisMode>All</AnalysisMode>
</PropertyGroup>
<ItemGroup>
<EditorConfigFiles Include=".editorconfig" />
</ItemGroup>
<PropertyGroup>
<AnalyzerConfigFiles Include="$(MSBuildProjectDirectory)\.analyzer.config" />
</PropertyGroup>
Then create a .analyzer.config file with:
is_global = true
PNA1000.OnlyForRecords = true
PNA1000.ExcludedMethodNames = ToString,Equals,GetHashCode
The most common and recommended approach is Option 1 with the .editorconfig file, as it's the standard way to configure analyzer settings in modern .NET projects.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
release with comunity feedback improvements