简体   繁体   中英

ReSharper Code Cleanup Adds Redundant Qualifiers

When I apply ReSharper's Code Cleanup, it is added qualifiers to static methods. I then see a diagnostic IDE0002 telling me the name can be simplified. This isn't a problem when I have Code Editing > General Formatter Style > Enable StyleCop support unchecked.

Example

public class Foo
{

    public void Bar()
    {
        StaticMethod();
    }

    private static void StaticMethod()
    {   
    }
}

Gets "cleaned up" to:

public class Foo
{
    public void Bar()
    {
        Foo.StaticMethod();
    }

    private static void StaticMethod()
    {

    }
}

How do I prevent ReSharper Code Cleanup from adding this qualifier and leaving the code unchanged?

Untick all checkboxes in Members to qualify dropdown list here ReSharper | Options | Code Editing | C# | Code Style | Static members qualifications ReSharper | Options | Code Editing | C# | Code Style | Static members qualifications

在此处输入图片说明

Since you've mentioned that unticking Enable StyleCop support checkbox in ReSharper Options helped, it looks like there is a setting in settings.stylecop file in your solution which overrides ReSharper setting (more about support for StyleCop config file you can find in Enable StyleCop support here )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM