简体   繁体   English

让Stylecop自动修复c#中的问题

[英]Get Stylecop to automatically fix issues in c#

Is it possible to get style cop to fix any issues? 是否可以让风格警察解决任何问题? Or any other tool to fix the style cop issues? 或任何其他工具来解决风格警察问题?

I understand that some of the issues may be complicated to code for but this one "SA1101: The call to UpdateButtonLocations must begin with the 'this.' 我理解代码中的一些问题可能很复杂但是这个问题“SA1101:对UpdateButtonLocations的调用必须以'this'开头。” prefix to indicate that the item is a member of the class." 前缀表示该项是该类的成员。“ looks like it should be fairly trivial to fix. 看起来它应该是相当微不足道的修复。

From reading around I think Resharper can be integrated so that it warns you of any issues as you code, and while this is useful it won't help me on an existing project with 100s of warnings similar to the one above! 通过阅读我认为Resharper可以集成,以便在您编码时警告您任何问题,虽然这很有用但它不会帮助我在现有的项目中提供类似于上面的100个警告!

There are many refactoring options built into Visual Studio 2010, and add-ons like Resharper (commercial) add many more. Visual Studio 2010中内置了许多重构选项,Resharper(商业)等附加组件添加了更多。

These are mostly automatic and will speed up fixing such issues. 这些大多是自动的,将加快解决这些问题。

There is a style cop addin for ReSharper available (Look here ). 可以使用ReSharper的样式警察插件( 在这里查看 )。 With that you can have the option to clean it manually or within the "Clean Code" functionality of ReSharper do it automatically. 有了这个,你可以选择手动清理它,或者在ReSharper的“清洁代码”功能中自动清除它。

Resharper does have a clean solution that will do this to all files in the solution. Resharper确实有一个干净的解决方案,可以解决方案中的所有文件。 Good idea or bad idea is up to you :) 好主意或坏主意取决于你:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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