[英]ReSharper Code Cleanup Adds Redundant Qualifiers
When I apply ReSharper's Code Cleanup, it is added qualifiers to static methods. 当我应用ReSharper的代码清除时,会将限定符添加到静态方法中。 I then see a diagnostic IDE0002 telling me the name can be simplified.
然后,我看到诊断IDE0002告诉我该名称可以简化。 This isn't a problem when I have Code Editing > General Formatter Style > Enable StyleCop support unchecked.
当我未选中代码编辑>常规格式化程序样式>启用StyleCop支持时,这不是问题。
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? 如何防止ReSharper代码清除添加此限定符并使代码保持不变?
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
选中Members to qualify
所有复选框Members to qualify
下拉列表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 ) 既然您提到取消勾选“ ReSharper选项”中的“
Enable StyleCop support
复选框是有帮助的,则您的解决方案中的settings.stylecop
文件中似乎有一个设置会覆盖ReSharper设置(有关支持StyleCop配置文件的更多信息,请参见“ Enable StyleCop support
在这里 )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.