GU0002

November 24, 2021 ยท View on GitHub

The position of a named argument should match

TopicValue
IdGU0002
SeverityHidden
EnabledTrue
CategoryGu.Analyzers.Correctness
CodeArgumentListAnalyzer

Description

The position of a named argument should match parameter position.

Motivation

This is just an OCD-thing. Enable the analyzer if you want named argument's position to match the parameter position.

How to fix violations

Use the code fix.

Configure severity

Via ruleset file.

Configure the severity per project, for more info see MSDN.

Via #pragma directive.

#pragma warning disable GU0002 // The position of a named argument should match
Code violating the rule here
#pragma warning restore GU0002 // The position of a named argument should match

Or put this at the top of the file to disable all instances.

#pragma warning disable GU0002 // The position of a named argument should match

Via attribute [SuppressMessage].

[System.Diagnostics.CodeAnalysis.SuppressMessage("Gu.Analyzers.Correctness", 
    "GU0002:The position of a named argument should match", 
    Justification = "Reason...")]