Skip to content

Latest commit

 

History

History
77 lines (60 loc) · 1.48 KB

File metadata and controls

77 lines (60 loc) · 1.48 KB

GU0018a

Name mock

Topic Value
Id GU0018a
Severity Warning
Enabled True
Category Gu.Analyzers.Correctness
Code VariableDeclaratorAnalyzer

Description

Name mock.

Motivation

namespace N { using Moq; using NUnit.Framework;

public class C
{
    [Test]
    public void M()
    {
        var ↓wrongName = new Mock<IPlc>(MockBehavior.Strict);
    }
}

}

How to fix violations

namespace N { using Moq; using NUnit.Framework;

public class C
{
    [Test]
    public void M()
    {
        var plcMock = new Mock<IPlc>(MockBehavior.Strict);
    }
}

}

Configure severity

Via ruleset file.

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

Via #pragma directive.

#pragma warning disable GU0018a // Name mock
Code violating the rule here
#pragma warning restore GU0018a // Name mock

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

#pragma warning disable GU0018a // Name mock

Via attribute [SuppressMessage].

[System.Diagnostics.CodeAnalysis.SuppressMessage("Gu.Analyzers.Correctness", 
    "GU0018a:Name mock", 
    Justification = "Reason...")]