我试图压制下了StyleCop消息特定属性:试图压制了StyleCop消息SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine
SA1513: Statements or elements wrapped in curly brackets must be followed by a blank line.
我努力做到以下几点,但它似乎不工作:
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")]
public string CustomerId
{
get
{
return this.GetProperty(CustomerIdProperty);
}
set
{
if (this.IsNew)
{
this.SetProperty(CustomerIdProperty, value);
}
else
{
throw new ReadOnlyException("Id value can only be changed for a new record.");
}
}
}
我只是做错了什么?或者这是不可能的?这是一个很好的规则,就我个人而言,对一个物业来说,这是不合法的。
更新
试图从DocumentationRules到LayoutRules切换......仍然没有抑制。
[DataObjectField(true, false)]
[SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")]
public string CustomerId
{
get
{
return this.GetProperty(CustomerIdProperty);
}
set
{
if (this.IsNew)
{
this.SetProperty(CustomerIdProperty, value);
}
else
{
throw new ReadOnlyException("Id value can only be changed for a new record.");
}
}
}
我认为这可能是一个错误...试图抑制该消息仍然给出警告。 – mattruma 2010-04-10 16:29:03
@mattruma - 我认为在这种情况下规则名称是正确的 – ChrisF 2010-04-10 16:42:23
我同意ChrisF的评估 - 即使在4.4中,SpacingRules和LayoutRules似乎也不能被抑制。 – Joe 2011-02-10 15:03:30