「トップページ/CSHARP/StyleCop」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
|&big(){StyleCop}|
#contents()
----
*設定
-SA1027が、いつの間にかOFFにできるようになった(@@
&s(){SA1027をOFFにしたいが、それはできないようだ。つまりタブは使えず、すべてスペースにしろってことらしい。}
-SA1630はOFFにしないと不都合がある。これは、「summaryタグ内の文字列にスペースがない」というエラーで、英文は区切りがスペースであり、それがないということは、ドキュメントがちゃんと書かれていないかも、ということを示している。日本語は句読点で区切ることができるため、ちゃんと書いてあってもこのエラーに引っかかる。
-SA1631はOFFにしないと不都合がある。これは、「summaryタグ内が、適切な文法構造に従うようには見えない」というエラーで、シンボルと非英字の割合で算出される。つまり、日本語とは関係ない。
----
*ヘッダーの例
<copyright file="AssemblyInfo.cs" company="J-FACTORY">(C)2012</copyright>
----
*ファイルを除外
プロジェクトファイル(.csproj)に細工をする
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
</ItemGroup>
ファイル先頭に下記を追加する(こっちのが簡単)
// <auto-generated />
----
*行やブロックを除外
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
Justification = "抑制する理由を書く")]
----
*参考
http://stylecop.soyuz5.com/StyleCop%20Rules.html
----
*1000 Spacing Rules
Microsoft.StyleCop.CSharp.SpacingRules
|SA1000|SA1000:KeywordsMustBeSpacedCorrectly&br()A violation of this rule occurs when the spacing around a keyword is incorrect.|
|SA1001:CommasMustBeSpaceCorrectly|The spacing around a comma is incorrect, within a C# code file.|
|SA1002:SemicolonsMustBeSpaceCorrectly|Invalid spacing around the semicolon.&br()セミコロンの前後の間隔が無効です。|
|SA1003:SymbolsMustBeSpaceCorrectly|The spacing around the symbol '+' is invalid.&br()'+'というシンボルの周りのスペースは無効です。|
|SA1004:DocumentationLinesMustBeginWithSingleSpace|The documentation header line must start with a single space.&br()ドキュメンテーションヘッダーの行は、シングルスペースから始まらなければなりません。|
|SA1005:SingleLineCommentsMustBeginWithSingleSpace|The comment must start with a single space. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.&br()コメントはシングルスペースから始まらなければなりません。コードの行をコメントアウトするときこのエラーを無視するには、'//'よりむしろ'////'でコメントを始めてください。|
|SA1006:PreprocessorKeywordsMustNotBePrecededBySpace|A violation of this rule occurs when the preprocessor-type keyword in a preprocessor directive is preceded by space.|
|SA1007:OperatorKeywordMustBeFollowedBySpace|A violation of this rule occurs when the operator keyword within an operator overload method is not followed by any whitespace. The operator keyword should always be followed by a single space.|
|SA1008:OpeningParenthesisMustBeSpacedCorrectly|A violation of this rule occurs when the opening parenthesis within a statement is not spaced correctly.|
|SA1009:ClosingParenthesisMustBeSpacedCorrectly|Invalid spacing around the closing parenthesis.&br()閉じ括弧の周りの無効のスペース|
|SA1010:OpeningSquareBracketsMustBeSpacedCorrectly|A violation of this rule occurs when an opening square bracket within a statement is preceded or followed by whitespace.|
|SA1011:ClosingSquareBracketsMustBeSpacedCorrectly|A violation of this rule occurs when the spacing around a closing square bracket is not correct.|
|SA1012:OpeningCurlyBracketsMustBeSpacedCorrectly|Invalid spacing around the opening curly bracket.&br()初めの中括弧の周りの無効のスペース。|
|SA1025:CodeMustNotContainMultipleWhitespaceInARow|The code contains multiple spaces in a row. Only one space is needed.&br()このコード行で複数のスペースが含まれています。唯一の1つのスペースが必要です。|
|SA1027:TabsMustNotBeUsed|Tabs are not allowed. Use spaces instead.&br()タブは許容されていません。 代わりにスペースを使用してください。|
----
*1100 Readability Rules
Microsoft.StyleCop.CSharp.ReadabilityRules
|SA1101|The call to components must begin with the 'this.' prefix to indicate that the item is a member of the class.&br()アイテムがクラスの一員であることを示すために、コンポーネントへの呼び出しは'this'接頭語で始めなければなりません。|
|SA1108|[SuppressMessage("Microsoft.StyleCop.CSharp.ReadabilityRules", "SA1108:BlockStatementsMustNotContainEmbeddedComments", Justification = "")]&br()コメントは括弧の中に置かなければなりません。|
|SA1115|The parameter must begin on the line after the previous parameter.&br()パラメタは前のパラメタの後の行の上で始まらなければなりません。|
|SA1116|If the method parameters are on separate lines, the first parameter must begin on the line beneath the name of the method.&br()メソッドパラメタが別々の行にあるなら、最初のパラメタはメソッド名の下の位置で始まらなければなりません。|
|SA1117|All method parameters must be placed on the same line, or each parameter must be placed on a separate line.&br()すべてのメソッドのパラメータは同じ行に配置するか、各パラメータごとに別の行に配置する必要があります。|
|SA1119|The line contains unnecessary parenthesis.&br()不必要な括弧の行を含んでいます。|
|SA1120|The comment is empty. Add text to the comment or remove it.&br()コメントは空です。コメントにテキストを追加または削除してください。|
|SA1121|Use the built-in type alias 'byte' rather than Byte or System.Byte.&br()ByteやSystem.Byteよりむしろ内蔵型別名'byte'を使用してください。&br()int,uint,short,ushort...|
|SA1122|Use string.Empty rather than "".&br()""よりstring.Emptyを使用してください。|
|SA1123|The use of regions is not allowed within code elements. Remove the #region and #endregion tags.&br()regionの使用はコード要素の中で許されていません。 #regionと#endregionタグを取り除いてください。|
----
*1200 Ordering Rules
Microsoft.StyleCop.CSharp.OrderingRules
|SA1200|All "using directives" must be placed inside of the namespace.&br()すべてのusingディレクティブは名前空間の内部に置かなければなりません。|
|SA1201|All constructors must be placed after all fields.&br()すべてのフィールドの後にすべてのコンストラクタを置かなければなりません。&br()●ファイル内の順番&br()Extern Alias&br()Directives&br()Using Directives&br()名前空間(Namespaces)&br()デリゲート(Delegates)&br()列挙型(Enums)&br()インターフェイス(Interfaces)&br()構造体(Structs)&br()クラス(Classes)&br()●クラスか構造体かインターフェイス内の順番&br()メンバ(Fields)&br()コンストラクタ(Constructors)&br()デストラクタ(Finalizers (Destructors))&br()デリゲート(Delegates)&br()イベント(Events)&br()列挙型(Enums)&br()インターフェイス(Interfaces)&br()プロパティ(Properties)&br()インデクサ(Indexers)&br()メソッド(Methods)&br()構造体(Structs)&br()クラス(Classes)|
|SA1202|All protected methods must be placed after all public methods.&br()すべてのprotectedメソッドはpublicメソッドの後ろに置かなければなりません。|
|SA1203|All constant and readonly private fields must be placed before all non-constant, non-readonly private fields.&br()すべての定数と読み取り専用プライベートフィールドは、非定数と非読み取り専用プライベートフィールドよりも前に配置する必要があります。|
|SA1204|All static private fields must be placed before all non-static private fields.&br()すべての静的なプライベートフィールドの前に全ての非静的プライベートフィールドを配置する必要があります。|
|SA1205|SA1205:PartialElementsMustDeclareAccess&br()The partial element does not have an access modifier defined.&br()部分的な要素は、アクセス修飾子を定めておきません。|
|SA1206|SA1206:DeclarationKeywordsMustFollowOrder&br()The access modifier keyword must come before the 'static' keyword in the element declaration.&br()アクセス修飾子キーワードは、要素宣言において『静的』キーワードの前に来なければなりません。|
|SA1210|Using directives must be sorted alphabetically by the namespaces.&br()using は名前空間のアルファベット順にソートされていなければなりません。|
----
*1300 Naming Rules
Microsoft.StyleCop.CSharp.NamingRules
|SA1300|method names begin with an upper-case letter: XXX&br()メソッド名は大文字アルファベットで始まります|
|SA1305|The variable name 'hByte2' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes.&br()変数名'hByte2'はハンガリーの記法に似ている接頭語で始まります。 接頭語を移すか、または許容接頭語のリストにそれを追加してください。|
|SA1306|Variable names must start with a lower-case letter: 変数名.&br()変数名は小文字アルファベットから始まらなければなりません|
|SA1307|Public and internal fields must start with an upper-case letter.&br()public、そして、internalのフィールドは大文字アルファベットから始まらなければなりません|
----
*1400 Maintainability Rules
Microsoft.StyleCop.CSharp.MaintainabilityRules
|SA1400|The class must have an access modifier.&br()クラスには、アクセス修飾語がなければなりません。|
|SA1401|SA1401:SA1401:FieldsMustBePrivate&br()Fields must be declared with private access. Use properties to expose fields.&br()プライベートでフィールドを申告しなければなりません。 プロパティを使用でフィールドを公開してください。|
|SA1402|SA1402:FileMayOnlyContainASingleClass&br()A violation of this rule occurs when a C# file contains more than one class.&br()ファイルはクラスをひとつだけ含むべきである|
|SA1404|A Code Analysis suppression must contain a non-empty justification describing the reason for the suppression.&br()コード解析の抑制、非空の正当性を抑制するための理由を記述する必要があります。|
|SA1405|A call to Debug.Assert must provide a message in the second parameter describing the reason for the assert.&br()Debug.Assertの呼び出しは、2番目のパラメータにassertの理由を表すメッセージを記述する必要があります。|
|SA1407|Insert parenthesis within the arithmetic expression to declare the operator precedence.&br()算術式の中に丸括弧を挿入して、演算子の優先順位を明確にしてください。|
----
*1500 Layout Rules
Microsoft.StyleCop.CSharp.LayoutRules
|SA1500|If a statement spans multiple lines, the opening curly bracket must be placed on its own line.&br()ステートメントが複数の行にかかっているなら、初めの中括弧をそれ自身の行に置かなければなりません。|
|SA1501|A statement containing curly brackets must not be placed on a single line. The opening and closing curly brackets must each be placed on their own line.&br()SA1501: 中括弧を含むステートメントを一行に置いてはいけません。 それぞれそれら自身の線に中括弧を置かなければなりません。|
|SA1502|SA1502:ElementMustNotBeOnASingleLine&br()The constructor must not be placed on a single line. The opening and closing curly brackets must each be placed on their own line.&br()コンストラクタを一行に置いてはいけません。 それぞれ初めの、そして、終わりの中括弧をそれら自身の線に置かなければなりません。|
|SA1503|The body of the if statement must be wrapped in opening and closing curly brackets.&br()本体は、中括弧でステートメントを包装しなければならない。|
|SA1505|An opening curly bracket must not be followed by a blank line.&br()空白行は初めの中括弧のあとに続いてはいけません。|
|SA1506|A documentation header line must not be followed by a blank line.&br()空白行はドキュメンテーションヘッダー行のあとに続いてはいけません。|
|SA1507|The code must not contain multiple blank lines in a row.&br()このコード行で、複数の空白行を含めることはできません。|
|SA1508|The code must not contain blank lines at the end of the file.&br()ファイル最後に空行を含んではなりません。|
|SA1510|An else, catch, or finally statement must not be preceded by a blank line.&br()else、catch、finallyステートメントは、空白行が先行することはできません。|
|SA1512| A single-line comment must not be followed by a blank line. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.&br()空白行は一行コメントのあとに続いてはいけません。コメントはシングルスペースから始まらなければなりません。コードの行をコメントアウトするときこのエラーを無視するには、'//'よりむしろ'////'でコメントを始めてください。|
|SA1513|Statements or elements wrapped in curly brackets must be followed by a blank line.&br()中括弧で囲まれたステートメントかエレメントは、空白行が続かなければなりません。|
|SA1514|A documentation header must be preceded by a blank line or must be the first item in its scope.&br()ドキュメンテーションヘッダーは、空白行が先行しなければならない、さもなければ、範囲で最初の項目であるに違いありません。|
|SA1515|A single-line comment must be preceded by a blank line or another single-line comment, or must be the first item in its scope. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.&br()SA1515: 1行のコメントは、空白行か別の単線コメントで先行しなければならないか、または範囲で最初の項目であるに違いありません。コメントはシングルスペースから始まらなければなりません。コードの行をコメントアウトするときこのエラーを無視するには、'//'よりむしろ'////'でコメントを始めてください。|
|SA1516|Adjacent elements must be separated by a blank line.&br()隣接するエレメントは、空白行で切り離さなければなりません。|
----
*1600 Documentation Rules
Microsoft.StyleCop.CSharp.DocumentationRules
|SA1600|The class must have a documentation header.&br()The method must have a documentation header.&br()クラス(メソッド)には、ドキュメンテーションヘッダーがなければなりません。|
|SA1601|The partial class element must have a documentation header containing either a summary tag or a content tag.&br()partial class要素には、summaryタグかcontentタグのどちらかを含むドキュメンテーションヘッダーがなければなりません。|
|SA1606|The summary section in the documentation header must not be empty.&br()ドキュメントヘッダーの概要のセクションを空にすることはできません。|
|SA1611|The documentation header must contain param tags matching the element's parameter list.&br()ドキュメンテーションヘッダーは要素のパラメータ・リストに合っているparamタグを含まなければなりません。|
|SA1612|The param tags in the documentation header must match the element's parameter list.&br()ドキュメンテーションヘッダーのparamタグは要素のパラメータ・リストに合わなければなりません|
|SA1614|The documentation text within the param tag for the '<param name="hdr"></param>' parameter must not be empty.&br()ドキュメントのテキストのparamタグの'<param name="xxx"></param>'が空であってはならない。|
|SA1615|The documentation header must contain a returns tag since the element has a return value.&br()戻り値を持っているエレメントのドキュメンテーションヘッダは、リターンタグを含める必要があります。 |
|SA1623|The property's documentation summary text must begin with: Gets&br()プロパティの<summary>は以下で始まらなければなりません。 Gets ...|
|SA1625|The documentation header contains two or more identical documentation strings. The only documentation text which may be duplicated is 'The parameter is not used.'.&br()ドキュメンテーションヘッダーは2個以上の同じドキュメンテーションストリングを含んでいます。 コピーされるかもしれない唯一のドキュメンテーションテキストは'parameter is not used.'。|
|SA1630|The documentation text within the summary tag does not contain any whitespace between words, indicating that it most likely does not follow a proper grammatical structure required for documentation text.&br()summaryタグの中のドキュメンテーションテキストは単語の間のどんな空白も含んでいません、たぶん適切な文法構造がドキュメンテーションテキストに必要であるということにならないのを示しています。|
|SA1631|The documentation text within the summary tag does not appear to follow a proper grammatical structure required for documentation text.&br()summaryタグの中のドキュメンテーションテキストはドキュメンテーションテキストに必要である適切な文法構造に従うように見えません。|
|SA1632|The documentation text within the summary tag must be at least 10 characters in length. Documentation failing to meet this guideline most likely does not follow a proper grammatical structure required for documentation text.&br()summaryタグの中のドキュメンテーションテキストは少なくとも10文字の長さでなければなりません。 このガイドラインを満たさないドキュメンテーションがたぶんドキュメンテーションテキストに必要である適切な文法構造に従いません。|
|SA1633|The file has no header, the header Xml is invalid, or the header is not located at the top of the file.&br()ファイルには、ヘッダーが全くないか、ヘッダーXmlが無効であるか、またはヘッダーはファイルの先頭に位置していません。|
|SA1634|The file header must contain a copyright tag.&br()ファイル先頭には、<copyright>タグがなくてはならない|
|SA1638|The file attribute in the file header's copyright tag must contain the name of the file.&br()ファイルヘッダーのファイル属性のcopyrightタグは、ファイル名を含まなければなりません。|
|SA1642|The documentation text within the constructor's summary tag must begin with the text:Initializes a new instance of the Form1 class.&br()コンストラクタのsummaryタグの中のドキュメンテーションテキストは"Initializes a new instance of the **** class"テキストで始まらなければなりません。|
|SA1643|The documentation text within the destructor's summary tag must begin with the text: Finalizes an instance of the **** class.&br()デストラクタのsummaryタグの中のドキュメンテーションテキストは"Finalizes an instance of the **** class"テキストで始まらなければなりません。|
|SA1644|The documentation header must not contain blank lines. Use the 'para' tag to insert line breaks within documentation text.&br()空白行は、ドキュメントヘッダーに含めることはできません。ドキュメントのテキストに改行を挿入するには'para'タグを使用してください。|
|SA1649|SA1649:FileHeaderFileNameDocumentationMustMatchTypeName&br()A violation of this rule occurs when the file tag within the file header at the top of a C# file does not contain the name of the first type in the file.&br()ファイルヘッダのファイルタグに、ファイル内の最初の名前が含まれていない|
----
*VisualStudioのエディタ設定
オプションダイアログ => テキストエディタ => C#
-タブ
--インデント&br()( ) なし&br()( ) ブロック&br()(O) スマート
--タブ&br()タブサイズ = 4&br()インデントサイズ = 4&br()(O) 空白の保持&br()( ) タブの保持
-書式設定
--全般&br()[V]‘;'を入力しステートメントを終了したときにオートフォーマットする&br()[V]‘}'を入力しブロックを終了したときにオートフォーマットする&br()[V] 貼り付け時にオートフォーマットする
--インデント&br()[V] ブロックの内容をインデントする&br()[ ] 初めと終わりのかっこをインデントする&br()[V] caseの内容をインデントする&br()[ ] caseのラベルをインデントする
---ラベルインデント&br()( ) gotoラベルを左端の列に配置する(O) gotoラベルを現在より1インデントだけ下げて配置する&br()( ) ラベルを標準にインデントする
--改行
---中かっこの改行オプション&br()[V] 新しい行に始めかっこを配置する&br()[V] 新しい行にメソッドの始めかっこを配置する&br()[V] 新しい行に匿名メソッドの始めかっこを配置する&br()[V] 新しい行にコントロールブロックの始めかっこを配置する&br()[V] 新しい行に匿名型の始めかっこを配置する&br()[V] 新しい行にオブジェクト初期化子の始めかっこを配置する&br()[V] 新しい行にラムダ式の始めかっこを配置する
---キーワードの改行オプション&br()[V] 新しい行に"else"を配置する&br()[V] 新しい行に"catch"を配置する&br()[V] 新しい行に"finally"を配置する
---式の改行オプション&br()[V] 新しい行にオブジェクト初期化子のメンバを配置する&br()[V] 新しい行に匿名型のメンバを配置する&br()[V] 新しい行にクエリ式の句を配置する
--行間
---メソッド宣言子のスペースを設定する&br()[ ] メソッド名と初めのかっこの間にスペースを挿入する&br()[ ] 引数リストのかっこ内にスペースを挿入する[ ] 空の引数リストのかっこ内にスペースを挿入する
---メソッド呼び出しのスペースを設定する&br()[ ] メソッド名と初めかっこの間にスペースを挿入する&br()[ ] 引数リストのかっこ内にスペースを挿入する&br()[ ] 空の引数リストのかっこ内にスペースを挿入する
---その他のスペースオプションを設定する&br()[V] 制御フローステートメント内のキーワードの後にスペースを挿入する&br()[ ] 式のかっこ内にスペースを挿入する&br()[ ] 型キャストのかっこ内にスペースを挿入する&br()[ ] 制御フローステートメントのかっこ内にスペースを挿入する&br()[ ] キャストの後にスペースを追加する&br()[V] 宣言ステートメント内のスペースを無視する&br()
---大かっこのスペースを設定する&br()[ ] 初め角かっこの前にスペースを挿入する&br()[ ] 空の角かっこ内にスペースを挿入する&br()[ ] 角かっこ内にスペースを挿入する
---区切り記号のスペースを設定する&br()[V] 型宣言で、基本またはインターフェイス用のコロンの後にスペースを配置する&br()[V] コンマの後にスペースを追加する&br()[ ] ピリオドの後にスペースを追加する&br()[V] "for"ステートメントでセミコロンの後にスペースを挿入する&br()[V] 型宣言で、基本またはインターフェイス用のコロンの前にスペースを挿入する&br()[ ] コンマの前にスペースを挿入する&br()[ ] ピリオドの前にスペースを挿入する&br()[ ] "for"ステートメントの前にスペースを挿入する
---演算子のスペースを設定する&br()(O) バイナリ演算子の前後にスペースを挿入する&br()( ) バイナリ演算子の前後のスペースを無視する&br()( ) バイナリ演算子の前後のスペースを削除する
---折り返し&br()[V] ブロックを単一行に配置する&br()[V] 1行に複数のステートメントとメンバ宣言を表示する
|&big(){StyleCop}|
#contents()
----
*設定
-SA1027が、いつの間にかOFFにできるようになった(@@
&s(){SA1027をOFFにしたいが、それはできないようだ。つまりタブは使えず、すべてスペースにしろってことらしい。}
-SA1630はOFFにしないと不都合がある。これは、「summaryタグ内の文字列にスペースがない」というエラーで、英文は区切りがスペースであり、それがないということは、ドキュメントがちゃんと書かれていないかも、ということを示している。日本語は句読点で区切ることができるため、ちゃんと書いてあってもこのエラーに引っかかる。
-SA1631はOFFにしないと不都合がある。これは、「summaryタグ内が、適切な文法構造に従うようには見えない」というエラーで、シンボルと非英字の割合で算出される。つまり、日本語とは関係ない。
----
*ヘッダーの例
<copyright file="AssemblyInfo.cs" company="J-FACTORY">(C)2012</copyright>
----
*ファイルを除外
プロジェクトファイル(.csproj)に細工をする
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
</ItemGroup>
ファイル先頭に下記を追加する(こっちのが簡単)
// <auto-generated />
----
*行やブロックを除外
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented",
Justification = "抑制する理由を書く")]
----
*参考
http://stylecop.soyuz5.com/StyleCop%20Rules.html
----
*1000 Spacing Rules
Microsoft.StyleCop.CSharp.SpacingRules
|SA1000|SA1000:KeywordsMustBeSpacedCorrectly&br()A violation of this rule occurs when the spacing around a keyword is incorrect.|
|SA1001:CommasMustBeSpaceCorrectly|The spacing around a comma is incorrect, within a C# code file.|
|SA1002:SemicolonsMustBeSpaceCorrectly|Invalid spacing around the semicolon.&br()セミコロンの前後の間隔が無効です。|
|SA1003:SymbolsMustBeSpaceCorrectly|The spacing around the symbol '+' is invalid.&br()'+'というシンボルの周りのスペースは無効です。|
|SA1004:DocumentationLinesMustBeginWithSingleSpace|The documentation header line must start with a single space.&br()ドキュメンテーションヘッダーの行は、シングルスペースから始まらなければなりません。|
|SA1005:SingleLineCommentsMustBeginWithSingleSpace|The comment must start with a single space. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.&br()コメントはシングルスペースから始まらなければなりません。コードの行をコメントアウトするときこのエラーを無視するには、'//'よりむしろ'////'でコメントを始めてください。|
|SA1006:PreprocessorKeywordsMustNotBePrecededBySpace|A violation of this rule occurs when the preprocessor-type keyword in a preprocessor directive is preceded by space.|
|SA1007:OperatorKeywordMustBeFollowedBySpace|A violation of this rule occurs when the operator keyword within an operator overload method is not followed by any whitespace. The operator keyword should always be followed by a single space.|
|SA1008:OpeningParenthesisMustBeSpacedCorrectly|A violation of this rule occurs when the opening parenthesis within a statement is not spaced correctly.|
|SA1009:ClosingParenthesisMustBeSpacedCorrectly|Invalid spacing around the closing parenthesis.&br()閉じ括弧の周りの無効のスペース|
|SA1010:OpeningSquareBracketsMustBeSpacedCorrectly|A violation of this rule occurs when an opening square bracket within a statement is preceded or followed by whitespace.|
|SA1011:ClosingSquareBracketsMustBeSpacedCorrectly|A violation of this rule occurs when the spacing around a closing square bracket is not correct.|
|SA1012:OpeningCurlyBracketsMustBeSpacedCorrectly|Invalid spacing around the opening curly bracket.&br()初めの中括弧の周りの無効のスペース。|
|SA1025:CodeMustNotContainMultipleWhitespaceInARow|The code contains multiple spaces in a row. Only one space is needed.&br()このコード行で複数のスペースが含まれています。唯一の1つのスペースが必要です。|
|SA1027:TabsMustNotBeUsed|Tabs are not allowed. Use spaces instead.&br()タブは許容されていません。 代わりにスペースを使用してください。|
----
*1100 Readability Rules
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "*", Justification = "")]
|SA1100|SA1100:DoNotPrefixCallsWithBaseUnlessLocalImplementationExists&br()継承されたクラスのメンバーへの呼び出しはbaseで始まらなくてはならない。|
|SA1101|The call to components must begin with the 'this.' prefix to indicate that the item is a member of the class.&br()アイテムがクラスの一員であることを示すために、コンポーネントへの呼び出しは'this'接頭語で始めなければなりません。|
|SA1108|SA1108:BlockStatementsMustNotContainEmbeddedComments&br()コメントは括弧の中に置かなければなりません。|
|SA1115|The parameter must begin on the line after the previous parameter.&br()パラメタは前のパラメタの後の行の上で始まらなければなりません。|
|SA1116|If the method parameters are on separate lines, the first parameter must begin on the line beneath the name of the method.&br()メソッドパラメタが別々の行にあるなら、最初のパラメタはメソッド名の下の位置で始まらなければなりません。|
|SA1117|All method parameters must be placed on the same line, or each parameter must be placed on a separate line.&br()すべてのメソッドのパラメータは同じ行に配置するか、各パラメータごとに別の行に配置する必要があります。|
|SA1119|The line contains unnecessary parenthesis.&br()不必要な括弧の行を含んでいます。|
|SA1120|The comment is empty. Add text to the comment or remove it.&br()コメントは空です。コメントにテキストを追加または削除してください。|
|SA1121|Use the built-in type alias 'byte' rather than Byte or System.Byte.&br()ByteやSystem.Byteよりむしろ内蔵型別名'byte'を使用してください。&br()int,uint,short,ushort...|
|SA1122|Use string.Empty rather than "".&br()""よりstring.Emptyを使用してください。|
|SA1123|The use of regions is not allowed within code elements. Remove the #region and #endregion tags.&br()regionの使用はコード要素の中で許されていません。 #regionと#endregionタグを取り除いてください。|
----
*1200 Ordering Rules
Microsoft.StyleCop.CSharp.OrderingRules
|SA1200|All "using directives" must be placed inside of the namespace.&br()すべてのusingディレクティブは名前空間の内部に置かなければなりません。|
|SA1201|All constructors must be placed after all fields.&br()すべてのフィールドの後にすべてのコンストラクタを置かなければなりません。&br()●ファイル内の順番&br()Extern Alias&br()Directives&br()Using Directives&br()名前空間(Namespaces)&br()デリゲート(Delegates)&br()列挙型(Enums)&br()インターフェイス(Interfaces)&br()構造体(Structs)&br()クラス(Classes)&br()●クラスか構造体かインターフェイス内の順番&br()メンバ(Fields)&br()コンストラクタ(Constructors)&br()デストラクタ(Finalizers (Destructors))&br()デリゲート(Delegates)&br()イベント(Events)&br()列挙型(Enums)&br()インターフェイス(Interfaces)&br()プロパティ(Properties)&br()インデクサ(Indexers)&br()メソッド(Methods)&br()構造体(Structs)&br()クラス(Classes)|
|SA1202|All protected methods must be placed after all public methods.&br()すべてのprotectedメソッドはpublicメソッドの後ろに置かなければなりません。|
|SA1203|All constant and readonly private fields must be placed before all non-constant, non-readonly private fields.&br()すべての定数と読み取り専用プライベートフィールドは、非定数と非読み取り専用プライベートフィールドよりも前に配置する必要があります。|
|SA1204|All static private fields must be placed before all non-static private fields.&br()すべての静的なプライベートフィールドの前に全ての非静的プライベートフィールドを配置する必要があります。|
|SA1205|SA1205:PartialElementsMustDeclareAccess&br()The partial element does not have an access modifier defined.&br()部分的な要素は、アクセス修飾子を定めておきません。|
|SA1206|SA1206:DeclarationKeywordsMustFollowOrder&br()The access modifier keyword must come before the 'static' keyword in the element declaration.&br()アクセス修飾子キーワードは、要素宣言において『静的』キーワードの前に来なければなりません。|
|SA1210|Using directives must be sorted alphabetically by the namespaces.&br()using は名前空間のアルファベット順にソートされていなければなりません。|
----
*1300 Naming Rules
Microsoft.StyleCop.CSharp.NamingRules
|SA1300|method names begin with an upper-case letter: XXX&br()メソッド名は大文字アルファベットで始まります|
|SA1305|The variable name 'hByte2' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes.&br()変数名'hByte2'はハンガリーの記法に似ている接頭語で始まります。 接頭語を移すか、または許容接頭語のリストにそれを追加してください。|
|SA1306|Variable names must start with a lower-case letter: 変数名.&br()変数名は小文字アルファベットから始まらなければなりません|
|SA1307|Public and internal fields must start with an upper-case letter.&br()public、そして、internalのフィールドは大文字アルファベットから始まらなければなりません|
----
*1400 Maintainability Rules
Microsoft.StyleCop.CSharp.MaintainabilityRules
|SA1400|The class must have an access modifier.&br()クラスには、アクセス修飾語がなければなりません。|
|SA1401|SA1401:SA1401:FieldsMustBePrivate&br()Fields must be declared with private access. Use properties to expose fields.&br()プライベートでフィールドを申告しなければなりません。 プロパティを使用でフィールドを公開してください。|
|SA1402|SA1402:FileMayOnlyContainASingleClass&br()A violation of this rule occurs when a C# file contains more than one class.&br()ファイルはクラスをひとつだけ含むべきである|
|SA1404|A Code Analysis suppression must contain a non-empty justification describing the reason for the suppression.&br()コード解析の抑制、非空の正当性を抑制するための理由を記述する必要があります。|
|SA1405|A call to Debug.Assert must provide a message in the second parameter describing the reason for the assert.&br()Debug.Assertの呼び出しは、2番目のパラメータにassertの理由を表すメッセージを記述する必要があります。|
|SA1407|Insert parenthesis within the arithmetic expression to declare the operator precedence.&br()算術式の中に丸括弧を挿入して、演算子の優先順位を明確にしてください。|
----
*1500 Layout Rules
Microsoft.StyleCop.CSharp.LayoutRules
|SA1500|If a statement spans multiple lines, the opening curly bracket must be placed on its own line.&br()ステートメントが複数の行にかかっているなら、初めの中括弧をそれ自身の行に置かなければなりません。|
|SA1501|A statement containing curly brackets must not be placed on a single line. The opening and closing curly brackets must each be placed on their own line.&br()SA1501: 中括弧を含むステートメントを一行に置いてはいけません。 それぞれそれら自身の線に中括弧を置かなければなりません。|
|SA1502|SA1502:ElementMustNotBeOnASingleLine&br()The constructor must not be placed on a single line. The opening and closing curly brackets must each be placed on their own line.&br()コンストラクタを一行に置いてはいけません。 それぞれ初めの、そして、終わりの中括弧をそれら自身の線に置かなければなりません。|
|SA1503|The body of the if statement must be wrapped in opening and closing curly brackets.&br()本体は、中括弧でステートメントを包装しなければならない。|
|SA1505|An opening curly bracket must not be followed by a blank line.&br()空白行は初めの中括弧のあとに続いてはいけません。|
|SA1506|A documentation header line must not be followed by a blank line.&br()空白行はドキュメンテーションヘッダー行のあとに続いてはいけません。|
|SA1507|The code must not contain multiple blank lines in a row.&br()このコード行で、複数の空白行を含めることはできません。|
|SA1508|The code must not contain blank lines at the end of the file.&br()ファイル最後に空行を含んではなりません。|
|SA1510|An else, catch, or finally statement must not be preceded by a blank line.&br()else、catch、finallyステートメントは、空白行が先行することはできません。|
|SA1512| A single-line comment must not be followed by a blank line. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.&br()空白行は一行コメントのあとに続いてはいけません。コメントはシングルスペースから始まらなければなりません。コードの行をコメントアウトするときこのエラーを無視するには、'//'よりむしろ'////'でコメントを始めてください。|
|SA1513|Statements or elements wrapped in curly brackets must be followed by a blank line.&br()中括弧で囲まれたステートメントかエレメントは、空白行が続かなければなりません。|
|SA1514|A documentation header must be preceded by a blank line or must be the first item in its scope.&br()ドキュメンテーションヘッダーは、空白行が先行しなければならない、さもなければ、範囲で最初の項目であるに違いありません。|
|SA1515|A single-line comment must be preceded by a blank line or another single-line comment, or must be the first item in its scope. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.&br()SA1515: 1行のコメントは、空白行か別の単線コメントで先行しなければならないか、または範囲で最初の項目であるに違いありません。コメントはシングルスペースから始まらなければなりません。コードの行をコメントアウトするときこのエラーを無視するには、'//'よりむしろ'////'でコメントを始めてください。|
|SA1516|Adjacent elements must be separated by a blank line.&br()隣接するエレメントは、空白行で切り離さなければなりません。|
----
*1600 Documentation Rules
Microsoft.StyleCop.CSharp.DocumentationRules
|SA1600|The class must have a documentation header.&br()The method must have a documentation header.&br()クラス(メソッド)には、ドキュメンテーションヘッダーがなければなりません。|
|SA1601|The partial class element must have a documentation header containing either a summary tag or a content tag.&br()partial class要素には、summaryタグかcontentタグのどちらかを含むドキュメンテーションヘッダーがなければなりません。|
|SA1606|The summary section in the documentation header must not be empty.&br()ドキュメントヘッダーの概要のセクションを空にすることはできません。|
|SA1611|The documentation header must contain param tags matching the element's parameter list.&br()ドキュメンテーションヘッダーは要素のパラメータ・リストに合っているparamタグを含まなければなりません。|
|SA1612|The param tags in the documentation header must match the element's parameter list.&br()ドキュメンテーションヘッダーのparamタグは要素のパラメータ・リストに合わなければなりません|
|SA1614|The documentation text within the param tag for the '<param name="hdr"></param>' parameter must not be empty.&br()ドキュメントのテキストのparamタグの'<param name="xxx"></param>'が空であってはならない。|
|SA1615|The documentation header must contain a returns tag since the element has a return value.&br()戻り値を持っているエレメントのドキュメンテーションヘッダは、リターンタグを含める必要があります。 |
|SA1623|The property's documentation summary text must begin with: Gets&br()プロパティの<summary>は以下で始まらなければなりません。 Gets ...|
|SA1625|The documentation header contains two or more identical documentation strings. The only documentation text which may be duplicated is 'The parameter is not used.'.&br()ドキュメンテーションヘッダーは2個以上の同じドキュメンテーションストリングを含んでいます。 コピーされるかもしれない唯一のドキュメンテーションテキストは'parameter is not used.'。|
|SA1630|The documentation text within the summary tag does not contain any whitespace between words, indicating that it most likely does not follow a proper grammatical structure required for documentation text.&br()summaryタグの中のドキュメンテーションテキストは単語の間のどんな空白も含んでいません、たぶん適切な文法構造がドキュメンテーションテキストに必要であるということにならないのを示しています。|
|SA1631|The documentation text within the summary tag does not appear to follow a proper grammatical structure required for documentation text.&br()summaryタグの中のドキュメンテーションテキストはドキュメンテーションテキストに必要である適切な文法構造に従うように見えません。|
|SA1632|The documentation text within the summary tag must be at least 10 characters in length. Documentation failing to meet this guideline most likely does not follow a proper grammatical structure required for documentation text.&br()summaryタグの中のドキュメンテーションテキストは少なくとも10文字の長さでなければなりません。 このガイドラインを満たさないドキュメンテーションがたぶんドキュメンテーションテキストに必要である適切な文法構造に従いません。|
|SA1633|The file has no header, the header Xml is invalid, or the header is not located at the top of the file.&br()ファイルには、ヘッダーが全くないか、ヘッダーXmlが無効であるか、またはヘッダーはファイルの先頭に位置していません。|
|SA1634|The file header must contain a copyright tag.&br()ファイル先頭には、<copyright>タグがなくてはならない|
|SA1638|The file attribute in the file header's copyright tag must contain the name of the file.&br()ファイルヘッダーのファイル属性のcopyrightタグは、ファイル名を含まなければなりません。|
|SA1642|The documentation text within the constructor's summary tag must begin with the text:Initializes a new instance of the Form1 class.&br()コンストラクタのsummaryタグの中のドキュメンテーションテキストは"Initializes a new instance of the **** class"テキストで始まらなければなりません。|
|SA1643|The documentation text within the destructor's summary tag must begin with the text: Finalizes an instance of the **** class.&br()デストラクタのsummaryタグの中のドキュメンテーションテキストは"Finalizes an instance of the **** class"テキストで始まらなければなりません。|
|SA1644|The documentation header must not contain blank lines. Use the 'para' tag to insert line breaks within documentation text.&br()空白行は、ドキュメントヘッダーに含めることはできません。ドキュメントのテキストに改行を挿入するには'para'タグを使用してください。|
|SA1649|SA1649:FileHeaderFileNameDocumentationMustMatchTypeName&br()A violation of this rule occurs when the file tag within the file header at the top of a C# file does not contain the name of the first type in the file.&br()ファイルヘッダのファイルタグに、ファイル内の最初の名前が含まれていない|
----
*VisualStudioのエディタ設定
オプションダイアログ => テキストエディタ => C#
-タブ
--インデント&br()( ) なし&br()( ) ブロック&br()(O) スマート
--タブ&br()タブサイズ = 4&br()インデントサイズ = 4&br()(O) 空白の保持&br()( ) タブの保持
-書式設定
--全般&br()[V]‘;'を入力しステートメントを終了したときにオートフォーマットする&br()[V]‘}'を入力しブロックを終了したときにオートフォーマットする&br()[V] 貼り付け時にオートフォーマットする
--インデント&br()[V] ブロックの内容をインデントする&br()[ ] 初めと終わりのかっこをインデントする&br()[V] caseの内容をインデントする&br()[ ] caseのラベルをインデントする
---ラベルインデント&br()( ) gotoラベルを左端の列に配置する(O) gotoラベルを現在より1インデントだけ下げて配置する&br()( ) ラベルを標準にインデントする
--改行
---中かっこの改行オプション&br()[V] 新しい行に始めかっこを配置する&br()[V] 新しい行にメソッドの始めかっこを配置する&br()[V] 新しい行に匿名メソッドの始めかっこを配置する&br()[V] 新しい行にコントロールブロックの始めかっこを配置する&br()[V] 新しい行に匿名型の始めかっこを配置する&br()[V] 新しい行にオブジェクト初期化子の始めかっこを配置する&br()[V] 新しい行にラムダ式の始めかっこを配置する
---キーワードの改行オプション&br()[V] 新しい行に"else"を配置する&br()[V] 新しい行に"catch"を配置する&br()[V] 新しい行に"finally"を配置する
---式の改行オプション&br()[V] 新しい行にオブジェクト初期化子のメンバを配置する&br()[V] 新しい行に匿名型のメンバを配置する&br()[V] 新しい行にクエリ式の句を配置する
--行間
---メソッド宣言子のスペースを設定する&br()[ ] メソッド名と初めのかっこの間にスペースを挿入する&br()[ ] 引数リストのかっこ内にスペースを挿入する[ ] 空の引数リストのかっこ内にスペースを挿入する
---メソッド呼び出しのスペースを設定する&br()[ ] メソッド名と初めかっこの間にスペースを挿入する&br()[ ] 引数リストのかっこ内にスペースを挿入する&br()[ ] 空の引数リストのかっこ内にスペースを挿入する
---その他のスペースオプションを設定する&br()[V] 制御フローステートメント内のキーワードの後にスペースを挿入する&br()[ ] 式のかっこ内にスペースを挿入する&br()[ ] 型キャストのかっこ内にスペースを挿入する&br()[ ] 制御フローステートメントのかっこ内にスペースを挿入する&br()[ ] キャストの後にスペースを追加する&br()[V] 宣言ステートメント内のスペースを無視する&br()
---大かっこのスペースを設定する&br()[ ] 初め角かっこの前にスペースを挿入する&br()[ ] 空の角かっこ内にスペースを挿入する&br()[ ] 角かっこ内にスペースを挿入する
---区切り記号のスペースを設定する&br()[V] 型宣言で、基本またはインターフェイス用のコロンの後にスペースを配置する&br()[V] コンマの後にスペースを追加する&br()[ ] ピリオドの後にスペースを追加する&br()[V] "for"ステートメントでセミコロンの後にスペースを挿入する&br()[V] 型宣言で、基本またはインターフェイス用のコロンの前にスペースを挿入する&br()[ ] コンマの前にスペースを挿入する&br()[ ] ピリオドの前にスペースを挿入する&br()[ ] "for"ステートメントの前にスペースを挿入する
---演算子のスペースを設定する&br()(O) バイナリ演算子の前後にスペースを挿入する&br()( ) バイナリ演算子の前後のスペースを無視する&br()( ) バイナリ演算子の前後のスペースを削除する
---折り返し&br()[V] ブロックを単一行に配置する&br()[V] 1行に複数のステートメントとメンバ宣言を表示する