如何强制 ReSharper 的 StyleCop 忽略文件?
我们刚刚致力于将 StyleCop 引入我们的团队,并正在使用 Code Plex 中的 StyleCop ReSharper 插件。 问题是,项目中的每个文件似乎都在被分析,我们找不到排除特定文件的方法。 这包括项目中包含的 DBML 或第三方组件中的 Designer.cs 文件等文件。 这意味着 ReSharper 中的站点范围代码分析总是显示错误,并且您永远无法使其变为“绿色”。
您始终可以将 ExcludeFromStyleCop 标记放入 .csproj 中,但这仅由 MSBuild 使用。 右键单击 ReSharper 错误窗口中的文件并告诉它“忽略错误”似乎也不起作用; 窗口会重新加载,并再次分析同一文件。
有人对此有什么想法吗?
We’ve just been working on introducing StyleCop to our team and are using the StyleCop ReSharper plugin from Code Plex. Problem is, every single file in the project appears to be getting analysed and we can’t find a way to exclude particular files. This includes files such as the designer.cs file from the DBML or third party components included in the project. What this means is your site wide code analysis in ReSharper always shows up errors and you can never get it to go “green”.
There’s always the ExcludeFromStyleCop tag which you can put in the .csproj but this is only used by MSBuild. Right clicking the file in the ReSharper error window and telling it to “Ignore Errors” also doesn’t seem to work; the window just reloads and the same file gets analysed again.
Anyone got any ideas on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这就是我一直在寻找的,除了在 Resharper 6 中,禁用特定文件中的检查的正确击键是:
Ctrl + Shift + Alt + 8
This was what I was looking for, except in Resharper 6 the correct keystroke to disable inspection in a specific file is:
Ctrl + Shift + Alt + 8
“您确定已取消选中指定 stylecop 应检查设计器文件的 StyleCop 设置选项吗?(StyleCop 选项 > 规则 > 详细设置 > 分析设计器文件)?”
http://stylecopforresharper.codeplex.com/Thread/View.aspx?ThreadId= 47346
"Are you sure you have have unchecked the StyleCop settings option that specifies stylecop should check designer files? (StyleCop Options > Rules > Detailed Settings > Analyze Designer Files)?"
http://stylecopforresharper.codeplex.com/Thread/View.aspx?ThreadId=47346
您可以通过按 CTRL + 8 来完全禁用特定文件的 ReSharper。 您会看到代码窗口右上角(装订线顶部)的小“眼睛”变成灰色,表明它已被禁用。
再次按下按键即可重新启用它。
You can completely disable ReSharper for a particular file by pressing CTRL + 8. You'll see the little 'eye' in the top right of the code window (at the top of the gutter) go grey, indicating it's disabled.
Press the keystroke again to re-enable it.