自动StyleCop
StyleCop 是一个很棒的视觉工作室小插件。但它不会向您显示实时提示或提供任何自动修复。
随之而来的是 reSharper 和 StyleCop for reSharper,这是理想的解决方案,但成本太高。
是否有一种开源方法来实现样式警察的实时代码提示和自动修复?
或者说 reSharper 是目前做到这一点的唯一方法?
提前致谢...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,有一种方法可以免费实现少量自动化 StyleCop 修复,而无需安装任何新软件。是的,读我的嘴唇,没有新软件!
Visual Studio 有许多内置功能,可以修复许多 StyleCop 错误。您所要做的就是设置并使用它们。听着,我会告诉你更多!
我个人最喜欢的一些是:
- 右键单击“重构”窗口(随时随地重命名任何内容!)
- 编辑/高级/格式文档结合对工具/选项/环境中 Visual Studio 设置的修改,并将这些设置保存在 .vssettings 文件中,并将这些设置与解决方案一起存储。让 Visual Studio 强化您的风格!呼啊!
- 自定义片段!只需按三次键即可显示整页样板!我知道您曾经梦想过这种生产力!
但是等等,还有更多!
至于“实时提示”,如果您右键单击错误列表中的 StyleCop 违规,您可以获得文档相应部分的链接来帮助您解决问题!就在那里,在您想要的地方,在您想要的时候!
绝不像 ReSharper 那样功能齐全,但没有的价格非常便宜!你不能拒绝这笔交易!
(此优惠对于使用 MSBuild 集成的用户并不完全有效)
Well, there is one way to achieve a small amount of automated StyleCop fixes for free without installing any new software. That's right, read my lips, no new software!
Visual Studio has lots of build-in features that will fix a lot of StyleCop errors. All you have to do is set it up and use them. Listen up, and I'll tell you more!
Some of my personal favourites are:
- the right-click Refactor window (rename anything, anytime, everywhere!)
- Edit/Advanced/Format Document combined with modifications to the Visual Studio settings in Tools/Options/Environment and saving those settings out in a .vssettings file and storing those settings with the solution. Make Visual Studio enforce your style! Hoo-ah!
- Custom Snippets! Make that full page of boilerplate appear with only three keystrokes! I know you've had dreams about this kind of productivity!
But wait, there's more!
As for "live hints", if you right-click on the StyleCop violation in the error list you can get a link to the appropriate section of documentation to help you out! Right there, where you want it, when you want it!
By no means as fully featured as ReSharper, but a bargain at the low-low price of nothing! You can't turn down this deal!
(offer not fully valid to those using MSBuild integration)
我最近开始使用另一个 DXCore 插件
CR_StyleNinja 是 CodeRush / CodeRush Xpress / DXCore 的免费插件
请参阅 社区插件网站上的“CR_StyleNinja 插件页面”
在撰写本文时, ,实施了 SA13xx 系列命名规则(已修复)。我还入手了SA14xx系列和SA11xx系列。
此外,规则将在适当的情况下适用于跨语言边界。因此,规则可以应用于 C# 或 VB.Net 或 DXCore 支持的任何其他语言。
该网站还有许多由社区的几位成员编写的其他插件。如果您想了解有关其中任何一个的更多信息,或者如果您想了解有关 CodeRush 的更多信息,< a href="http://devexpress.com/crx" rel="nofollow noreferrer">CodeRush Xpress, RefactorPro 或 DXCore,然后随时与我联系。 有关我的社区插件作者页面的详细信息
I have recently begun another DXCore Plugin
CR_StyleNinja is a free plugin for the CodeRush / CodeRush Xpress / DXCore
See the CR_StyleNinja plugin page on the community plugin site
At the time of writing, the SA13xx series of naming rules are implemented (complete with fixes). I have also started the SA14xx series and the SA11xx series.
Additionally rules will apply themselves across language boundaries where appropriate. Thus rules can be applied to C# or VB.Net or any other language supported by the DXCore.
The site has many other plugins written by several members of the community. If you wish to learn more about any of them, or if you'd like to know more about CodeRush, CodeRush Xpress, RefactorPro or the DXCore, then feel free to contact me. Details on my Community plugin Author page
您可以尝试 StyleCop for CodeRush 插件。您只需要安装 DevExpress 的 DXCore 插件(免费) 。一个警告:该项目处于 alpha 阶段,似乎没有任何活动。
You can try the StyleCop for CodeRush plugin. You only need to install the DXCore plugin from DevExpress (which is free). One warning: this project is in alpha and there doesn't seem to be any activity.