CSharp_IngeniousAnalyzer 3.1.0
dotnet add package CSharp_IngeniousAnalyzer --version 3.1.0
NuGet\Install-Package CSharp_IngeniousAnalyzer -Version 3.1.0
<PackageReference Include="CSharp_IngeniousAnalyzer" Version="3.1.0" />
<PackageVersion Include="CSharp_IngeniousAnalyzer" Version="3.1.0" />
<PackageReference Include="CSharp_IngeniousAnalyzer" />
paket add CSharp_IngeniousAnalyzer --version 3.1.0
#r "nuget: CSharp_IngeniousAnalyzer, 3.1.0"
#:package CSharp_IngeniousAnalyzer@3.1.0
#addin nuget:?package=CSharp_IngeniousAnalyzer&version=3.1.0
#tool nuget:?package=CSharp_IngeniousAnalyzer&version=3.1.0
CSharp_IngeniousAnalyzer (English)
A static analyzer designed to dramatically improve the code quality of your C# projects. It automatically detects issues such as insecure null checks, inefficient LINQ queries, and magic numbers, helping you maintain a safe and clean codebase.
Feedback
Thank you very much for using this analyzer in your daily development. I created this tool based on my own professional needs, and I am committed to improving it to be more useful for your development workflows. Your feedback is very valuable to me. If you have any requests, suggestions for new rules, or encounter any issues, please feel free to reach out via the "Contact owners" link on the NuGet package page, or open an issue/discussion on our GitHub Repository. I would be honored to grow and refine this tool together with all of you.
How to use
This analyzer is fully integrated with Visual Studio's "Live Code Analysis." Simply open your project, and it will automatically analyze your code as you edit it, providing real-time warnings. If it does not run automatically, try rebuilding the project, restarting Visual Studio, or deleting the hidden .vs folder in your project root.
It also works the same way with dotnet build, VS Code (with the C# extension), and JetBrains Rider, since it's a standard Roslyn analyzer distributed as a NuGet package.
Coding Style
We use .editorconfig to enforce a unified code style and maintain high maintainability. We recommend ensuring the following settings are applied to maintain consistent code quality:
- Visual Studio: Supports .editorconfig by default.
- VS Code: Installing the EditorConfig for VS Code extension is recommended.
Customizing Rules
Default warning levels are set, but you can adjust them to fit your development environment or preferences. For example, to change a rule's severity from warning to info, modify your .editorconfig as follows:
Example: Changing COLL001 from 'warning' to 'info' dotnet_diagnostic.COLL001.severity = warning ↓ dotnet_diagnostic.COLL001.severity = info
Rule List
| ID | Title | Message |
|---|---|---|
| NULL001 | Safety improvement by unifying to the 'is null' pattern | Use the type-safe 'is null' pattern instead of operators (== / !=). |
| STR001 | Optimization by standardizing on string.Empty | Use lowercase 'string.Empty' instead of 'String.{0}' for consistency. |
| STR002 | Safety improvement by replacing with nameof | Use type-safe 'nameof({0})' instead of the magic string '{0}'. |
| STR003 | Code optimization by removing redundant ToString() calls | '{0}' is already a string. Remove the redundant '.ToString()' call. |
| LINQ001 | Performance improvement by integrating LINQ evaluation | Integrate the Where().{0}() chain into a single '{0}(predicate)' for optimization. |
| LINQ002 | Removal of unnecessary collection materialization | '{0}' is not reused after enumeration. Remove this call to avoid unnecessary memory allocation. |
| COLL001 | Memory reduction by specifying initial List capacity | Specify an initial capacity in the List constructor as the loop count is predictable. |
| COMM001 | Improved readability and maintainability by adding documentation comments | Function header is missing. Please add the documentation comments. |
| COMM002 | Improved accuracy by synchronizing function header parameters | Function header parameters do not match the method definition. Please synchronize '{0}'. |
| CPX001 | Improve readability by reducing method complexity | Method '{0}' has a complexity of {1} (threshold: 17). Consider refactoring or splitting the logic. |
| CPX002 | Improve maintainability by splitting long methods | Method '{0}' has {1} lines of code but only {2} method invocations. Please consider refactoring by extracting logic into smaller methods. |
| COMP001 | Standardization of inequality operator direction | Please reverse the inequality signs to improve readability. |
| EXC001 | Improved maintainability by clarifying exception handling | The catch block for '{0}' is empty. Add handling, or if this is intentional, leave a comment explaining why. |
CSharp_IngeniousAnalyzer (日本語)
C#のコード品質を劇的に高める静的アナライザーです。 NULLチェックの型安全性欠如や、非効率なLINQ等を自動検知し、安全でクリーンなコードへの修正を支援します。
フィードバックについて
本アナライザーを日々ご利用いただき、誠にありがとうございます。 このツールは私自身が業務で「あったらいいな」と考えたものを形にしたものです。 至らぬ点もあるかと存じますが、より使いやすく、皆様の開発の助けとなるよう、継続的に改善を行っていきたいと考えています。 皆様からのご意見は大変貴重な財産です。 「ここをこうしてほしい」「このルールがあると嬉しい」といったご要望やフィードバックがございましたら、NuGetページ右下の「Contact owners」、または GitHubリポジトリのIssues/Discussions よりお気軽にご連絡ください。 皆様と一緒にこのツールを育てていけたら幸いです。
使い方
本アナライザーは Visual Studio の「Live Code Analysis」と完全に統合されています。 プロジェクトを開くだけで、コードの編集時に自動的に解析が実行され、問題がある場合はリアルタイムで警告が表示されます。 自動的に解析が実行されない場合は、リビルド、VS再起動、またはプロジェクトルートにある .vs フォルダー(隠しフォルダー)の削除を試してください。
標準的なRoslynアナライザーとしてNuGetパッケージ経由で配布しているため、dotnet build・VS Code(C#拡張機能)・JetBrains Riderでも同様に動作します。
コーディングスタイル
本プロジェクトでは、コードスタイルを統一し、保守性を維持するために .editorconfig を採用しています。
- Visual Studio: .editorconfig は標準でサポートされています。
- VS Code: EditorConfig for VS Code 拡張機能のインストールを推奨します。
ルールのカスタマイズ
デフォルトの警告レベルは設定済みですが、開発環境に合わせて .editorconfig で調整可能です。
例: COLL001の警告を info に変更する dotnet_diagnostic.COLL001.severity = warning ↓ dotnet_diagnostic.COLL001.severity = info
Rule List (ルール一覧)
| ID | Title (JP) | Message (JP) |
|---|---|---|
| NULL001 | 'is null'パターンへの統一による安全性向上 | 演算子(== / !=)ではなく、型安全な 'is null' パターンを使用してください。 |
| STR001 | string.Emptyへの統一による最適化 | 'String.{0}' ではなく、一貫性を持たせるため小文字の 'string.Empty' を使用してください。 |
| STR002 | nameofへの置き換えによる安全性向上 | 文字列リテラル '{0}' ではなく、型安全な 'nameof({0})' を使用してください。 |
| STR003 | 冗長なToString()呼び出しの削除によるコード最適化 | '{0}' は既にstring型です。冗長な '.ToString()' 呼び出しを削除してください。 |
| LINQ001 | LINQ評価の統合によるパフォーマンス向上 | Where().{0}() のチェーンを、単一の '{0}(predicate)' に統合して最適化してください。 |
| LINQ002 | 不要なコレクションの実体化の削除 | '{0}' は列挙後に再利用されていません。メモリ確保を回避するため、呼び出しを削除してください。 |
| COLL001 | List初期キャパシティ指定によるメモリ削減 | ループ回数が予測可能なため、Listのコンストラクタに初期キャパシティを指定してください。 |
| COMM001 | ドキュメントコメント追加による可読性・保守性の向上 | 関数ヘッダーが記述されていません。ドキュメントコメントを追加してください。 |
| COMM002 | パラメータ同期による関数ヘッダーの整合性向上 | 関数ヘッダーのパラメータがメソッド定義と一致していません。'{0}' を同期してください。 |
| CPX001 | メソッドの複雑度削減による可読性の向上 | メソッド '{0}' の複雑度が {1} です(閾値: 17)。分割やリファクタリングを検討してください。 |
| CPX002 | メソッド分割による保守性の向上 | メソッド '{0}' は {1} 行と長大です。関数呼び出しが {2} 回と少ないため、処理の分割(メソッド抽出)を検討してください。 |
| COMP001 | 不等号演算子の向きの統一 | 可読性向上のため、不等号を反転させてください。 |
| EXC001 | 例外処理の明確化による保守性向上 | '{0}' のcatchブロックが空です。処理を追加するか、意図的な場合はその理由をコメントで記述してください。 |
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.1.0 | 35 | 8/18/2026 |
| 3.0.2 | 82 | 8/17/2026 |
| 3.0.1 | 82 | 8/12/2026 |
| 3.0.0 | 97 | 8/3/2026 |
| 2.2.6 | 94 | 7/28/2026 |
| 2.2.5 | 98 | 7/27/2026 |
| 2.2.4 | 93 | 7/26/2026 |
| 2.2.3 | 97 | 7/23/2026 |
| 2.2.0 | 108 | 7/17/2026 |
| 2.1.0 | 100 | 7/13/2026 |
| 2.0.0 | 102 | 7/3/2026 |
| 1.7.7 | 100 | 7/1/2026 |
| 1.7.6 | 103 | 6/25/2026 |
| 1.7.5 | 210 | 6/17/2026 |
| 1.7.4 | 104 | 6/15/2026 |
| 1.7.3 | 98 | 6/7/2026 |
| 1.7.2 | 106 | 6/6/2026 |
| 1.7.1 | 111 | 6/6/2026 |
| 1.7.0 | 93 | 6/6/2026 |
| 1.6.4 | 102 | 6/6/2026 |
- EXC001(空のcatchブロック検知)・STR003(冗長なToString()呼び出し検知)を追加
- COMM001/COMM002がGenerateDocumentationFile未設定環境で正しく動作しない不具合を修正
- STR002/STR003のFixが一部ケースで正しく動作しない不具合を修正
- Add EXC001 (empty catch block) and STR003 (redundant ToString) rules
- Fix COMM001/COMM002 not working without GenerateDocumentationFile
- Fix STR002/STR003 code fixes not working correctly in some cases