NDepend: A C# Static Code Analysis Tool
What NDepend Checks in Your C# Code
Static code analysis inspects your C# code without running it. NDepend analyzes the whole code base, including the dependencies between projects, namespaces, types and methods, and checks it against 235 default rules. Each rule is a short, readable CQLinq query (C# LINQ over the code model) that you can adapt or extend:
- Code Smells (10), for example Avoid types too big and Avoid types with too many methods.
- Object Oriented Design (14), for example Avoid interfaces too big and Base class should not use derivatives.
- Design (16), for example Avoid custom delegates and Types with disposable instance fields must be disposable.
- Architecture (13), for example Avoid namespaces mutually dependent and Avoid namespaces dependency cycles.
- Dead Code (5), for example Potentially Dead Types and Potentially Dead Methods.
- Security (39), for example Software Composition Analysis (SCA) and Transitive Software Composition Analysis (SCA).
- Immutability (15), for example Fields should be marked as ReadOnly when possible and Avoid non-readonly static fields.
- Visibility (12), for example Methods that could have a lower visibility and Types that could have a lower visibility.
- Naming Conventions (23), for example Instance fields naming convention and Static fields naming convention.
- API Breaking Changes (9), for example API Breaking Changes: Types and API Breaking Changes: Methods.
- Code Coverage (15), for example Code should be tested and New Types and Methods should be tested.
Each issue comes with an estimated technical debt, and quality gates can fail the build when new code adds critical issues. Results are available in Visual Studio, in CI and in the HTML report, and NDepend.AI steers your coding agent to fix the issues found.
Trusted by the Industry
NDepend was created by developers for developers. It has been a tool trusted by 12.000+ companies since 2004.
"NDepend is giving me insight into my apps that I hadn't had before. Once I realized the depth and breadth of the information I was looking at, I was like a kid in a candy shop."
"When you have to analyze a lot of code there is no better static analysis tool than NDepend"