{"meta":{"title":"コード品質の C# CodeQL クエリ","intro":"CodeQL が C# で記述されたコードのコード品質を分析するために使用するクエリを調べる。","product":"セキュリティとコードの品質","breadcrumbs":[{"href":"/ja/enterprise-cloud@latest/code-security","title":"セキュリティとコードの品質"},{"href":"/ja/enterprise-cloud@latest/code-security/reference","title":"リファレンス"},{"href":"/ja/enterprise-cloud@latest/code-security/reference/code-quality","title":"コードの品質"},{"href":"/ja/enterprise-cloud@latest/code-security/reference/code-quality/codeql-queries","title":"CodeQL クエリ"},{"href":"/ja/enterprise-cloud@latest/code-security/reference/code-quality/codeql-queries/csharp-queries","title":"C# クエリ"}],"documentType":"article"},"body":"# コード品質の C# CodeQL クエリ\n\nCodeQL が C# で記述されたコードのコード品質を分析するために使用するクエリを調べる。\n\nCode Quality は、以下の CodeQL クエリを使用して C# コードを分析し、コード品質に関する問題を検出します。\n\n* あなたの**既定のブランチ**の結果が、リポジトリの \"標準の結果\" ダッシュボードに表示されます。\n* \n              **Pull requests** が、発見された事項とともに `github-code-quality[bot]` によってコメントとして表示されました\n\nCopilot Autofix の提案は、可能な場合に検出結果に対して提供されます。\n\n<div class=\"ghd-tool rowheaders\">\n\n| クエリ名 | カテゴリ | Severity |\n| --- | --- | --- |\n| \n              [1 つの Response.Write() でコードをブロックする](https://codeql.github.com/codeql-query-help/csharp/cs-asp-response-write/) | 保守性 | 勧告 |\n| \n              [古いメソッドの呼び出し](https://codeql.github.com/codeql-query-help/csharp/cs-call-to-obsolete-method/) | 保守性 | Warnung |\n| \n              [クラスの名前はスーパー クラスと同じです](https://codeql.github.com/codeql-query-help/csharp/cs-class-name-matches-base-class/) | 保守性 | 勧告 |\n| \n              [クラスは ICloneable を実装します](https://codeql.github.com/codeql-query-help/csharp/cs-class-implements-icloneable/) | 保守性 | 勧告 |\n| \n              [定数条件](https://codeql.github.com/codeql-query-help/csharp/cs-constant-condition/) | 保守性 | Warnung |\n| \n              [コンテナーの内容にアクセスしない](https://codeql.github.com/codeql-query-help/csharp/cs-unused-collection/) | 保守性 | エラー |\n| \n              [スーパークラスのフィールドをマスクするフィールド](https://codeql.github.com/codeql-query-help/csharp/cs-field-masks-base-field/) | 保守性 | Warnung |\n| \n              [無駄な条件](https://codeql.github.com/codeql-query-help/csharp/cs-useless-if-statement/) | 保守性 | Warnung |\n| \n              [ローカル スコープ変数の shadows メンバー](https://codeql.github.com/codeql-query-help/csharp/cs-local-shadows-member/) | 保守性 | 勧告 |\n| \n              ['readonly' の機会を見逃しました](https://codeql.github.com/codeql-query-help/csharp/cs-missed-readonly-modifier/) | 保守性 | 勧告 |\n| \n              [\"using\" の機会を見逃しました](https://codeql.github.com/codeql-query-help/csharp/cs-missed-using-statement/) | 保守性 | 勧告 |\n| \n              [[すべて] を使用する機会が見逃されました](https://codeql.github.com/codeql-query-help/csharp/cs-linq-missed-all/) | 保守性 | 勧告 |\n| \n              [Cast を使用する機会が見逃されました](https://codeql.github.com/codeql-query-help/csharp/cs-linq-missed-cast/) | 保守性 | 勧告 |\n| \n              [OfType を使用する機会が見逃されました](https://codeql.github.com/codeql-query-help/csharp/cs-linq-missed-oftype/) | 保守性 | 勧告 |\n| \n              [Select を使用する機会が見逃されました](https://codeql.github.com/codeql-query-help/csharp/cs-linq-missed-select/) | 保守性 | 勧告 |\n| \n              [Where を使用する機会が見逃されました](https://codeql.github.com/codeql-query-help/csharp/cs-linq-missed-where/) | 保守性 | 勧告 |\n| \n              [三元的な機会を逃した](https://codeql.github.com/codeql-query-help/csharp/cs-missed-ternary-operator/) | 保守性 | 勧告 |\n| \n              [入れ子になった 'if' ステートメントを組み合わせることができます](https://codeql.github.com/codeql-query-help/csharp/cs-nested-if-statements/) | 保守性 | 勧告 |\n| \n              [冗長選択](https://codeql.github.com/codeql-query-help/csharp/cs-linq-useless-select/) | 保守性 | Warnung |\n| \n              [冗長 ToString() 呼び出し](https://codeql.github.com/codeql-query-help/csharp/cs-useless-tostring-call/) | 保守性 | 勧告 |\n| \n              [インスタンス メソッドによって書き込まれた静的フィールド](https://codeql.github.com/codeql-query-help/csharp/cs-static-field-written-by-instance/) | 保守性 | 勧告 |\n| \n              [不必要に複雑なブール式](https://codeql.github.com/codeql-query-help/csharp/cs-simplifiable-boolean-expression/) | 保守性 | 勧告 |\n| \n              [未使用のラベル](https://codeql.github.com/codeql-query-help/csharp/cs-unused-label/) | 保守性 | Warnung |\n| \n              [ローカル変数への無駄な代入](https://codeql.github.com/codeql-query-help/csharp/cs-useless-assignment-to-local/) | 保守性 | Warnung |\n| \n              [GetHashCode() の役に立たない呼び出し](https://codeql.github.com/codeql-query-help/csharp/cs-useless-gethashcode-call/) | 保守性 | 勧告 |\n| \n              [待機中にロックが保持される](https://codeql.github.com/codeql-query-help/csharp/cs-locked-wait/) | Reliability | Warnung |\n| \n              ['System.IO.Path.Combine' を呼び出すと、以前の引数が自動的に削除される場合があります](https://codeql.github.com/codeql-query-help/csharp/cs-path-combine/) | Reliability | 勧告 |\n| \n              [GC.Collect() の呼び出し](https://codeql.github.com/codeql-query-help/csharp/cs-call-to-gc/) | Reliability | Warnung |\n| \n              [値型式に対する ReferenceEquals(...) の呼び出し](https://codeql.github.com/codeql-query-help/csharp/cs-reference-equality-on-valuetypes/) | Reliability | エラー |\n| \n              [アンマネージ コードの呼び出し](https://codeql.github.com/codeql-query-help/csharp/cs-call-to-unmanaged-code/) | Reliability | 勧告 |\n| \n              [型パラメーターへの 'this' のキャスト](https://codeql.github.com/codeql-query-help/csharp/cs-cast-of-this-to-type-parameter/) | Reliability | 勧告 |\n| \n              [StringBuilder コンストラクターに渡される文字](https://codeql.github.com/codeql-query-help/csharp/cs-stringbuilder-initialized-with-character/) | Reliability | エラー |\n| \n              [同じ値の比較](https://codeql.github.com/codeql-query-help/csharp/cs-comparison-of-identical-expressions/) | Reliability | Warnung |\n| \n              [コンテナーの内容が初期化されない](https://codeql.github.com/codeql-query-help/csharp/cs-empty-collection/) | Reliability | エラー |\n| \n              [コンテナー サイズとゼロの比較](https://codeql.github.com/codeql-query-help/csharp/cs-test-for-negative-container-size/) | Reliability | Warnung |\n| \n              [逆参照された変数は常に null です](https://codeql.github.com/codeql-query-help/csharp/cs-dereferenced-value-is-always-null/) | Reliability | エラー |\n| \n              [逆参照された変数は null である可能性があります](https://codeql.github.com/codeql-query-help/csharp/cs-dereferenced-value-may-be-null/) | Reliability | Warnung |\n| \n              ['this' の不審なダウンキャスト](https://codeql.github.com/codeql-query-help/csharp/cs-downcast-of-this/) | Reliability | Warnung |\n| \n              ['this' の疑わしい型テスト](https://codeql.github.com/codeql-query-help/csharp/cs-type-test-of-this/) | Reliability | Warnung |\n| \n              [空の条件分岐または空のループ本体](https://codeql.github.com/codeql-query-help/csharp/cs-empty-block/) | Reliability | Warnung |\n| \n              [空の「lock」ステートメント](https://codeql.github.com/codeql-query-help/csharp/cs-empty-lock-statement/) | Reliability | Warnung |\n| \n              [浮動小数点値の等値チェック](https://codeql.github.com/codeql-query-help/csharp/cs-equality-on-floats/) | Reliability | Warnung |\n| \n              [コレクションに対する equals](https://codeql.github.com/codeql-query-help/csharp/cs-equals-on-arrays/) | Reliability | 勧告 |\n| \n              [比較不可能な型に対する等価演算](https://codeql.github.com/codeql-query-help/csharp/cs-equals-on-unrelated-types/) | Reliability | エラー |\n| \n              [内部表現の公開](https://codeql.github.com/codeql-query-help/csharp/cs-expose-implementation/) | Reliability | 勧告 |\n| \n              [フィールドでの無駄な同期](https://codeql.github.com/codeql-query-help/csharp/cs-unsafe-sync-on-field/) | Reliability | エラー |\n| \n              [一般的な catch 句](https://codeql.github.com/codeql-query-help/csharp/cs-catch-of-all-exceptions/) | Reliability | 勧告 |\n| \n              [GetHashCode 定義のないハッシュ値](https://codeql.github.com/codeql-query-help/csharp/cs-gethashcode-is-not-defined/) | Reliability | Warnung |\n| \n              [不可能な配列キャスト](https://codeql.github.com/codeql-query-help/csharp/cs-impossible-array-cast/) | Reliability | エラー |\n| \n              [一貫性のないロック シーケンス](https://codeql.github.com/codeql-query-help/csharp/cs-inconsistent-lock-sequence/) | Reliability | エラー |\n| \n              [ContainsKey の非効率的な使用](https://codeql.github.com/codeql-query-help/csharp/cs-inefficient-containskey/) | Reliability | 勧告 |\n| \n              [文字列の書式設定が無効です](https://codeql.github.com/codeql-query-help/csharp/cs-invalid-string-formatting/) | Reliability | エラー |\n| \n              [lock ステートメントで 'this' オブジェクトをロックする](https://codeql.github.com/codeql-query-help/csharp/cs-lock-this/) | Reliability | Warnung |\n| \n              [ローカル IDisposable で Dispose 呼び出しが見つからない](https://codeql.github.com/codeql-query-help/csharp/cs-local-not-disposed/) | Reliability | Warnung |\n| \n              [同一変数を使用する入れ子ループ](https://codeql.github.com/codeql-query-help/csharp/cs-nested-loops-with-same-variable/) | Reliability | Warnung |\n| \n              [Equals(object) への Null 引数](https://codeql.github.com/codeql-query-help/csharp/cs-null-argument-to-equals/) | Reliability | Warnung |\n| \n              [コンテナーの長さに対するオフバイワン比較](https://codeql.github.com/codeql-query-help/csharp/cs-index-out-of-bounds/) | Reliability | エラー |\n| \n              [エラー処理が不適切: NullReferenceException のキャッチ](https://codeql.github.com/codeql-query-help/csharp/cs-catch-nullreferenceexception/) | Reliability | Warnung |\n| \n              [エラー処理が不適切: 空の catch ブロック](https://codeql.github.com/codeql-query-help/csharp/cs-empty-catch-block/) | Reliability | 勧告 |\n| \n              [精度が失われる可能性があります](https://codeql.github.com/codeql-query-help/csharp/cs-loss-of-precision/) | Reliability | エラー |\n| \n              [非短絡ロジックの潜在的に危険な使用](https://codeql.github.com/codeql-query-help/csharp/cs-non-short-circuit/) | Reliability | エラー |\n| \n              [プロパティの設定時にプロパティ値が使用されない](https://codeql.github.com/codeql-query-help/csharp/cs-unused-property-value/) | Reliability | Warnung |\n| \n              [Equals(object) への再帰呼び出し](https://codeql.github.com/codeql-query-help/csharp/cs-recursive-equals-call/) | Reliability | エラー |\n| \n              [例外変数の再スロー](https://codeql.github.com/codeql-query-help/csharp/cs-rethrown-exception-variable/) | Reliability | Warnung |\n| \n              [自己代入](https://codeql.github.com/codeql-query-help/csharp/cs-self-assignment/) | Reliability | エラー |\n| \n              [ループ内の文字列連結](https://codeql.github.com/codeql-query-help/csharp/cs-string-concatenation-in-loop/) | Reliability | 勧告 |\n| \n              [ループでの StringBuilder の作成](https://codeql.github.com/codeql-query-help/csharp/cs-stringbuilder-creation-in-loop/) | Reliability | 勧告 |\n| \n              [Equals メソッド内にある Uncheck のキャスト](https://codeql.github.com/codeql-query-help/csharp/cs-unchecked-cast-in-equals/) | Reliability | Warnung |\n| \n              [非管理コード](https://codeql.github.com/codeql-query-help/csharp/cs-unmanaged-code/) | Reliability | 勧告 |\n| \n              [既定の ToString() の使用](https://codeql.github.com/codeql-query-help/csharp/cs-call-to-object-tostring/) | Reliability | Warnung |\n\n</div>"}