标识及提示 |
中文及示例 |
是否检查 |
SA1600: ElementsMustBeDocumented |
元素必须被注释
///
/// Joins a first name and a last name together into a single string.
///
/// The first name to join.
/// The last name to join.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
return firstName + " " + lastName;
} |
√ |
SA1601: PartialElementsMustBeDocumented |
部分元素必须被注释
///
/// Documentation for the first part of Class1.
///
public partial class Class1
{
}
///
/// Documentation for the second part of Class1.
///
public partial class Class1
{
} |
√ |
SA1602: EnumerationItemsMustBeDocumented |
枚举项必须被注释
///
/// Types of animals.
///
public enum Animals
{
///
/// Represents a dog.
///
Dog,
///
/// Represents a cat.
///
Cat,
///
/// Represents a horse.
///
Horse
} |
√ |
SA1603: DocumentationMustContainValidXml |
文档必须包含有效的XML注释
///
/// An example of badly formed Xml.
///
public class Example
{
} |
√ |
SA1604: ElementDocumentationMustHaveSummary |
文档注释必须包含Summary
///
/// Represents a customer in the database.
///
public class Customer
{
} |
√ |
SA1605: PartialElementDocumentationMustHaveSummary |
部分文档注释必须包含Summary
///
/// Documentation for the first part of Class1.
///
public partial class Class1
{
}
///
/// Documentation for the second part of Class1.
///
public partial class Class1
{
} |
√ |
SA1606: ElementDocumentationMustHaveSummaryText |
文档注释Summary必须有内容
///
/// The ID of the customer to find.
/// The customer, or null if the customer could not be
/// found.
public Customer FindCustomer(int customerId)
{
// ... finds the customer ...
} |
√ |
SA1607: PartialElementDocumentationMustHaveSummaryText |
部分文档注释Summary必须有内容
///
/// The ID of the customer to find.
/// The customer, or null if the customer could not be found.
public Customer FindCustomer(int customerId)
{
// ... finds the customer ...
}
修复代码
/// Attempts to locate a record for the customer with the given ID.
/// The ID of the customer to find.
/// The customer, or null if the customer could not be found.
public Customer FindCustomer(int customerId)
{
// ... finds the customer ...
} |
√ |
SA1608: ElementDocumentationMustNotHaveDefaultSummary |
文档注释不能有默认的Summary
///
/// Summary description for the Example class.
///
public class Example
{
} |
√ |
SA1609: PropertyDocumentationMustHaveValue |
属性注释必须有值
///
/// Gets the name of the customer.
///
/// The name of the customer.
public bool Name
{
get { return this.name; }
} |
√ |
SA1610: PropertyDocumentationMustHaveValueText |
属性注释必须有值内容
///
/// Gets the name of the customer.
///
/// The name of the customer.
public bool Name
{
get { return this.name; }
} |
√ |
SA1611: ElementParametersMustBeDocumented |
元素的参数必须注释
///
/// Joins a first name and a last name together into a single string.
///
/// The first name to join.
/// The last name to join.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
return firstName + " " + lastName;
} |
√ |
SA1612: ElementParameterDocumentationMustMatchElementParameters |
元素的参数注释必须与元素参数成对
///
/// Joins a first name and a last name together into a single string.
///
/// The first name to join.
/// The last name to join.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
return firstName + " " + lastName;
} |
√ |
SA1613: ElementParameterDocumentationMustDeclareParameterName |
元素的参数注释必须定义参数名
///
/// Joins a first name and a last name together into a single string.
///
/// The first name to join.
/// The last name to join.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
return firstName + " " + lastName;
} |
√ |
SA1614: ElementParameterDocumentationMustHaveText |
元素的参数注释必须有值
///
/// Joins a first name and a last name together into a single string.
///
/// The first name to join.
/// The last name to join.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
return firstName + " " + lastName;
} |
√ |
SA1615: ElementReturnValueMustBeDocumented |
元素的返回值必须被注释
///
/// Joins a first name and a last name together into a single string.
///
/// The first name to join.
/// The last name to join.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
return firstName + " " + lastName;
} |
√ |
SA1616: ElementReturnValueDocumentationMustHaveValue |
元素的返回值注释必须有值
///
/// Joins a first name and a last name together into a single string.
///
/// The first name to join.
/// The last name to join.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
return firstName + " " + lastName;
} |
√ |
SA1617: VoidReturnValueMustNotBeDocumented |
元素空返回值不能注释
///
/// Prints the given name.
///
/// The first name.
/// The last name.
public void PrintNames(string firstName, string lastName)
{
Console.WriteLine(firstName + " " + lastName);
} |
√ |
SA1618: GenericTypeParametersMustBeDocumented |
泛型参数必须被注释
///
/// A sample generic class.
///
/// The first generic type parameter.
/// The second generic type parameter.
public class Class1
{
} |
√ |
SA1619: GenericTypeParametersMustBeDocumentedPartialClass |
泛型参数在部分类中必须被注释
///
/// A sample generic class.
///
/// The first generic type parameter.
/// The second generic type parameter.
public class Class1
{
} |
√ |
SA1620: GenericTypeParameterDocumentationMustMatchTypeParameters |
泛型参数注释必须与参数类型对应
///
/// A sample generic class.
///
/// The first generic type parameter.
/// The second generic type parameter.
public class Class1
{
} |
√ |
SA1621: GenericTypeParameterDocumentationMustDeclareParameterName |
泛型参数注释必须定义参数名
///
/// A sample generic class.
///
/// The first generic type parameter.
/// The second generic type parameter.
public class Class1
{
} |
√ |
SA1622: GenericTypeParameterDocumentationMustHaveText |
泛型参数注释必须有内容
///
/// A sample generic class.
///
/// The first generic type parameter.
/// The second generic type parameter.
public class Class1
{
} |
√ |
SA1623: PropertySummaryDocumentationMustMatchAccessors |
属性摘要文档必须和访问者对应
(参考帮助文档) |
√ |
SA1624: PropertySummaryDocumentationMustOmitSetAccessorWithRestricedAccess |
属性摘要文档必须必须省略设置访问器约束访问
(参考帮助文档) |
√ |
SA1625: ElementDocumentationMustNotBeCopiedAndPasted |
元素注释不能被拷贝和粘贴
///
/// Joins a first name and a last name together into a single string.
///
/// The first name to join.
/// The last name to join.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
return firstName + " " + lastName;
} |
√ |
SA1626: SingleLineCommentsMustNotUseDocumentationStyleSlashes |
单行注释不能使用斜线样式
///
/// Joins a first name and a last name together into a single string.
///
/// Part of the name.
/// Part of the name.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
A legal comment beginning with two slashes:
// Join the names together.
string fullName = firstName + " " + lastName;
An illegal comment beginning with three slashes:
/// Trim the name.
fullName = fullName.Trim();
A line of commented-out code beginning with four slashes:
////fullName = asfd;
return fullName;
} |
√ |
SA1627: DocumentationTextMustNotBeEmpty |
注释内容不能为空
///
/// Joins a first name and a last name together into a single string.
///
///
/// Part of the name.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
...
} |
√ |
SA1628: DocumentationTextMustBeginWithACapitalLetter |
注释内容首字母必须大写
///
/// joins a first name and a last name together into a single string.
///
/// The first name.
/// The last name.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
...
} |
√ |
SA1629: DocumentationTextMustEndWithAPeriod |
注释内容必须用句号结尾
///
/// Joins a first name and a last name together into a single string
///
/// The first name.
/// The last name.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
...
} |
√ |
SA1630: DocumentationTextMustContainWhitespace |
注释内容单词之间必须包含空白符
///
/// Joinsnames
///
/// First
/// Last
/// Name
public string JoinNames(string firstName, string lastName)
{
...
} |
|
SA1631: DocumentationTextMustMeetCharacterPercentage |
注释内容必须满足字符比例特殊字符不能过多
///
/// @)$(*A name--------
///
public class Name
{
...
} |
|
SA1632: DocumentationTextMustMeetMinimumCharacterLength |
注释内容必须满足小写字符长度
///
/// A name
///
public class Name
{
...
} |
√ |
SA1633: FileMustHaveHeader |
文件必须有文件头部注释
//-----------------------------------------------------------------------
//
// Company copyright tag.
//
//-----------------------------------------------------------------------
For example, a file called Widget.cs from a fictional company called Sprocket Enterprises should contain a file header similar to the following:
//-----------------------------------------------------------------------
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
//-----------------------------------------------------------------------
The dashed lines at the top and bottom of the header are not strictly necessary, so the header could be written as:
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
It is possible to add additional tags, although they will not be checked or enforced by StyleCop:
//-----------------------------------------------------------------------
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
// John Doe
//----------------------------------------------------------------------- |
√ |
SA1634: FileHeaderMustShowCopyright |
文件头部注释必须显示版权信息标识
//-----------------------------------------------------------------------
// A file header which does not contain a copyright tag
//-----------------------------------------------------------------------
A file header should include a copyright tag, as follows:
//-----------------------------------------------------------------------
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
//----------------------------------------------------------------------- |
√ |
SA1635: FileHeaderMustHaveCopyrightText |
文件头部注释必须有版权信息表示内容
//-----------------------------------------------------------------------
//
//
//-----------------------------------------------------------------------
A file header should include copyright text, as follows:
//-----------------------------------------------------------------------
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
//----------------------------------------------------------------------- |
√ |
SA1636: FileHeaderMustContainFileName |
文件头部注释必须包含文件名
//-----------------------------------------------------------------------
//
// Custom company copyright tag.
//
//----------------------------------------------------------------------- |
√ |
SA1637: FileHeaderMustContainFileName |
文件头部注释必须包含文件名
//-----------------------------------------------------------------------
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
//----------------------------------------------------------------------- |
√ |
SA1638: FileHeaderFileNameDocumentationMustMatchFileName |
文件头部注释文件名注释必须与文件名对应
//-----------------------------------------------------------------------
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
//-----------------------------------------------------------------------
A violation of this rule would occur, since the file tag does not contain the name of the file. The header should be written as:
//-----------------------------------------------------------------------
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
//----------------------------------------------------------------------- |
√ |
SA1639: FileHeaderMustHaveSummary |
文件头部注释不许有摘要
//-----------------------------------------------------------------------
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
//-----------------------------------------------------------------------
If this rule is enabled, the file header should contain a summary tag. For example:
//-----------------------------------------------------------------------
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
// Defines the Widget class.
//----------------------------------------------------------------------- |
√ |
SA1640: FileHeaderMustHaveValidCompanyText |
文件头部注释必须有正确的公司信息
//-----------------------------------------------------------------------
//
// Copyright (c) Sprocket Enterprises. All rights reserved.
//
//----------------------------------------------------------------------- |
√ |
SA1641: FileHeaderCompanyNameTextMustMatch |
文件头部注释公司内容必须对应
//-----------------------------------------------------------------------
//
// Custom company copyright tag.
//
//----------------------------------------------------------------------- |
√ |
SA1642: ConstructorSummaryDocumentationMustBeginWithStandardText |
构造器的Summary注释必须由标准内容开始
(参考帮助文档) |
√ |
SA1643: DestructorSummaryDocumentationMustBeginWithStandardText |
析构器的Summary注释必须由标准内容开始
///
/// Initializes a new instance of the class.
///
public Customer()
{
}
///
/// Initializes a new instance of the class.
///
public Customer()
{
} |
√ |
SA1644: DocumentationHeadersMustNotContainBlankLines |
注释头部不能包含空白行
///
///
/// Joins a first name and a last name together into a single string.
///
/// Uses a simple form of string concatenation.
///
///
/// The first name to join.
/// The last name to join.
/// The joined names.
public string JoinNames(string firstName, string lastName)
{
return firstName + " " + lastName;
} |
√ |
SA1645: IncludedDocumentationFileDoesNotExist |
导入的文档注释文件不存在
///
public bool Enabled(bool true)
{
}
|
√ |
SA1646: IncludedDocumentationXPathDoesNotExist |
导入的文档注释的XPath不存在
///
public bool Enabled(bool true)
{
} |
√ |
SA1647: IncludeNodeDoesNotContainValidFileAndPath |
导入的结点不存在正确的文件和路径
///
public bool Enabled(bool true)
{
} |
√ |