ReSharper - 如何在代码清理中禁用垃圾文档标头的生成

发布于 12-16 18:47 字数 317 浏览 9 评论 0原文

我们将 ReSharper 6.0 与 StyleCop for ReSharper 结合使用。

尽管我们使用 StyleCop 规则,即成员必须具有文档标题,但我们不希望 ReSharper 的代码清理工具为我们生成文档标题,因为它们不可避免地是垃圾。糟糕的文档标题比没有更糟糕,因为它们更新的可能性比一开始就添加的可能性要小。

我们尝试在 ReSharper => 中关闭设置“将文本插入文档和文件头”选项=>工具=> StyleCop 但是当你重新启动 Visual Studio 时它会自行重置。

有什么想法可以阻止代码清理为我们创建文档标题吗?

We're using ReSharper 6.0 with StyleCop for ReSharper.

Although we use the StyleCop rule that members must have documentation headers, we don't want ReSharper's code cleanup facility to generate documentation headers for us, because they're inevitably rubbish. Bad doc headers are worse than none at all because they're less likely to be updated than added in the first place.

We tried turning off the setting 'Insert text into documentation and file headers' in ReSharper => Options => Tools => StyleCop but it bloody resets itself when you restart visual studio.

Any ideas how we can stop Code Cleanup creating documentation headers for us?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

内心激荡2024-12-23 18:47:03

ReSharper ->选项->工具部分->代码清理->选择 StyleCop 个人资料 ->文档部分->取消勾选 1600。

将阻止创建默认文档标题,但 StyleCop 仍会强制要求它们应该存在。

ReSharper -> Options -> Tools section -> Code Cleanup -> select StyleCop profile -> Documentation section -> untick 1600.

Will prevent default documentation headers being created but StyleCop will still enforce that they should be there.

谜泪2024-12-23 18:47:03

阻止代码生成之后的第二步是清除垃圾。
我通过 Visual Studio 使用正则表达式搜索/替换。

正则表达式用于标头:

// ---.*\r\n\/\/.*\r\n\/\/.*\r\n\/\/.*\r\n\/\/.*\r\n\/\/.*\r\n.*\r\n\/\/.-{116}

正则表达式用于删除生成的摘要

\s{4}\/\/\/\s<summary>(.*)\r\n.*\r\n.*</summary>

警告:它将删除所有摘要,甚至是好的摘要,因此在启动之前检查替换范围。 (git checkout 可能是你的朋友......)

The second step, after blocking code generation is Removing the rubbish.
I used a regex Search/Replace through visual studio.

Regex is for header :

// ---.*\r\n\/\/.*\r\n\/\/.*\r\n\/\/.*\r\n\/\/.*\r\n\/\/.*\r\n.*\r\n\/\/.-{116}

Regex to remove Generated summaries

\s{4}\/\/\/\s<summary>(.*)\r\n.*\r\n.*</summary>

Caution : it will remove ALL summaries, even the good ones, so check the replacement scope before launching it. (git checkout might be your friend...)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文