Global.asax.cs 文件和 StyleCop 规则 SA1649 存在问题
目前我正在开发一个项目,我们正在考虑将 StyleCop 从版本 4.3.3 升级到 4.5
在这一切的乐趣中,我们遇到了规则 SA1649 - “FileHeaderFileNameDocumentationMustMatchTypeName”,这一切都很好,而且,但会导致 Global.asax.cs 文件出现问题,因为该文件
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Global.asax.cs" company="COMPANY">
// Copyright (c) COMPANY. All rights are reserved.....
// </copyright>
// <summary>
// Starting point for back office website.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Foo.Web
{
/// <summary>
/// Starting point for back office website.
/// </summary>
public class MvcApplication : HttpApplication
{
....
}
}
因文件名“Global.asax.cs”和类而受到投诉“MvcApplication”不匹配。我们尝试在 sylecop 设置中放置“Global.asax.cs”的抑制列表,但这似乎不起作用。 (目前我们的解决方法是完全禁用该规则,但我们不想保持这种情况,我们只希望 Global.asax.cs 文件例外。)
Currently I'm working on a project at work and we're looking at upgrading our StyleCop from version 4.3.3 to 4.5
During the fun of all that, we've come across rule SA1649 - "FileHeaderFileNameDocumentationMustMatchTypeName" which is all nice and that, but causes issues with Global.asax.cs files, in that the file
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Global.asax.cs" company="COMPANY">
// Copyright (c) COMPANY. All rights are reserved.....
// </copyright>
// <summary>
// Starting point for back office website.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Foo.Web
{
/// <summary>
/// Starting point for back office website.
/// </summary>
public class MvcApplication : HttpApplication
{
....
}
}
Is being complained about because the file name 'Global.asax.cs' and the class 'MvcApplication' don't match. We've tried to put a supress list for 'Global.asax.cs' in the sylecop settings but this didn't seem to work. (Currently our work around is to disable the rule entirely but we don't want to keep that as the case, we only want the exception for Global.asax.cs files.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用命名空间级别抑制:
Use a namespace level suppression:
经过一些时间和对原始工具生成的文件的操作发现了它。
希望这可以帮助其他人解决这个问题。
Found it out with a bit of time and manipulation of the original tool generated file.
Hope this helps out anyone else with this issue.