禁用所有ReSharper的警告与评论 [英] Disable all Resharper warnings with a comment

查看:119
本文介绍了禁用所有ReSharper的警告与评论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来禁用文件或代码段用一个注释所有ReSharper的警告?我试图创造面试潜在的候选人一些编码练习,而ReSharper的警告,白送我想考生发现问题:P。抑制特定警告仍然使得它很明显的问题是什么

Is there a way to disable all Resharper warnings for a file or section of code with a single comment? I'm trying to create some coding exercises for interviewing potential candidates, and the Resharper warnings give away the problem I want the candidate to spot :P Suppressing the specific warning still makes it obvious what the problem is.

我还是希望有在接受采访时可用ReSharper的,我只是想应聘者发现没有ReSharper的破坏的乐趣这个问题。

I still want to have Resharper available during the interview, I just want the candidate to spot this problem without Resharper spoiling the fun.

< STRONG>修改:对不起,我会尽量了解我后更加清晰。我不想永久禁用特定ReSharper的警告,我只是希望它不是在一个特定的文件显示,由于练习的要点是看开发商理解为警告的原因。

edit: Sorry I'll try to be more clear about what I'm after. I don't want to permanently disable a particular Resharper warning, I just want it to not show in one particular file, because the point of the exercise is to see if the developer understands the reason for the warning.

要举一个例子,有一个ReSharper的警告使用。任何扩展方法,而不是COUNT()> 0,这是我想开发商指出自己。要禁用警告,你必须使用的注释:<

To give one example, there is a Resharper warning to use the .Any extension method instead of Count() > 0, which I want the developer to point out themselves. To disable that warning, you have to use a comment of:

// ReSharper disable UseMethodAny.0

周围的代码。 。那种马脚一点

around the code. That kind of gives the game away a little.

我试图找到这样的:

// ReSharper disable all

,我可以在放置的顶部类,所以它不会放弃我想开发商找一下。但我似乎无法找到一个方法来做到这一点。使用数字为ReSharper的警告,将被罚款为好,但我不认为它的工作原理呀?

which I could place at the top of the class, so it won't give away what I want the developer to find. But I can't seem to find a way to do that. Using numbers for the Resharper warnings would be fine as well, but I don't think it works that way?

推荐答案

在JetBrains的博客这个博客帖子,在ReSharper的8将有是一个单一的注释,可以在一个文件中禁用ReSharper的。

According to this blog post on the JetBrains blog, in ReSharper 8 there will be a single comment that can disable resharper in a file.

这将是

// ReSharper disable All

注:全部是区分大小写的剩下的就是不行。

Note: The "All" is case-sensitive, the rest is not.

这篇关于禁用所有ReSharper的警告与评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆