microsoft / referencesource
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 158,420 units with 2,120,190 lines of code in units (66.6% of code).
    • 331 very complex units (90,685 lines of code)
    • 1,209 complex units (140,809 lines of code)
    • 6,706 medium complex units (372,790 lines of code)
    • 14,273 simple units (413,450 lines of code)
    • 135,901 very simple units (1,102,456 lines of code)
4% | 6% | 17% | 19% | 51%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
cs4% | 6% | 17% | 19% | 52%
vb3% | 6% | 25% | 26% | 37%
js2% | 10% | 24% | 20% | 42%
pl0% | 0% | 55% | 0% | 44%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
System.Data9% | 10% | 15% | 16% | 46%
System.Web.DataVisualization18% | 20% | 24% | 13% | 22%
System5% | 6% | 22% | 20% | 45%
mscorlib3% | 5% | 17% | 18% | 54%
System.Web3% | 7% | 19% | 19% | 49%
System.Xml5% | 13% | 22% | 19% | 39%
System.Data.Entity1% | 2% | 13% | 18% | 63%
System.Data.Linq8% | 9% | 17% | 17% | 46%
System.ServiceModel<1% | 2% | 13% | 20% | 62%
System.Data.SqlXml4% | 5% | 19% | 21% | 48%
System.Workflow.Activities4% | 6% | 14% | 19% | 55%
Microsoft.CSharp5% | 14% | 23% | 15% | 40%
Microsoft.VisualBasic3% | 6% | 25% | 26% | 37%
System.Runtime.Serialization2% | 4% | 18% | 18% | 56%
System.Activities1% | 1% | 11% | 21% | 63%
System.Workflow.ComponentModel2% | 8% | 22% | 23% | 43%
System.IdentityModel2% | 4% | 22% | 22% | 48%
System.Configuration5% | 13% | 19% | 16% | 45%
System.Core1% | 1% | 14% | 19% | 62%
System.Web.Services3% | 5% | 31% | 23% | 35%
System.Web.Extensions1% | 6% | 18% | 23% | 49%
System.ServiceModel.Internals3% | 1% | 11% | 20% | 63%
System.Web.Mobile<1% | 2% | 18% | 19% | 59%
System.Web.Routing16% | 0% | 19% | 23% | 40%
xsd14% | 20% | 33% | 11% | 19%
aspnet_compiler39% | 0% | 14% | 14% | 31%
System.Activities.Core.Presentation0% | 6% | 14% | 19% | 58%
System.ServiceModel.Web0% | 10% | 19% | 20% | 49%
System.Activities.Presentation0% | 1% | 12% | 22% | 62%
System.ServiceModel.Activities0% | 2% | 14% | 21% | 61%
System.Messaging0% | 10% | 19% | 15% | 54%
System.WorkflowServices0% | 3% | 17% | 25% | 53%
System.Data.Entity.Design0% | 4% | 14% | 18% | 62%
System.Numerics0% | 7% | 12% | 12% | 66%
System.Workflow.Runtime0% | 2% | 19% | 26% | 52%
inc0% | 6% | 11% | 15% | 66%
System.Xml.Linq0% | 3% | 16% | 33% | 47%
System.ServiceModel.Activation0% | 2% | 14% | 18% | 63%
System.ServiceProcess0% | 7% | 15% | 18% | 58%
System.Runtime.DurableInstancing0% | 3% | 8% | 23% | 64%
System.Web.Entity0% | 3% | 16% | 23% | 56%
System.Data.DataSetExtensions0% | 11% | 14% | 18% | 54%
System.Configuration.Install0% | 8% | 26% | 30% | 33%
System.Net0% | 0% | 29% | 18% | 51%
XamlBuildTask0% | 0% | 27% | 28% | 43%
System.Activities.DurableInstancing0% | 0% | 30% | 16% | 53%
Microsoft.Bcl0% | 0% | 10% | 16% | 72%
System.Device0% | 0% | 23% | 19% | 57%
System.ServiceModel.Channels0% | 0% | 5% | 21% | 72%
System.ServiceModel.Routing0% | 0% | 8% | 26% | 64%
System.ServiceModel.Discovery0% | 0% | 2% | 18% | 78%
System.Web.Entity.Design0% | 0% | 7% | 17% | 75%
System.ComponentModel.DataAnnotations0% | 0% | 12% | 20% | 66%
System.Runtime.Caching0% | 0% | 8% | 35% | 55%
System.IdentityModel.Selectors0% | 0% | 10% | 15% | 73%
Microsoft.Activities.Build0% | 0% | 27% | 32% | 40%
System.Web.DynamicData0% | 0% | 4% | 20% | 75%
SMDiagnostics0% | 0% | 5% | 22% | 71%
System.Web.ApplicationServices0% | 0% | 13% | 32% | 54%
regexes0% | 0% | 55% | 0% | 44%
System.ServiceModel.WasHosting0% | 0% | 0% | 29% | 70%
Microsoft.Bcl.Async0% | 0% | 0% | 9% | 90%
System.Xaml.Hosting0% | 0% | 0% | 11% | 88%
regcomp0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
internal static RegexReplacement ParseReplacement()
in System/regex/system/text/regularexpressions/RegexParser.cs
1410 479 5
internal SqlInternalConnectionTds()
in System.Data/fx/src/data/System/Data/SqlClient/SqlInternalConnectionTds.cs
1687 355 13
internal SqlInternalConnectionTds()
in System.Data/System/Data/SqlClient/SqlInternalConnectionTds.cs
1683 353 13
private bool TryReadInternal()
in System.Data/System/Data/SqlClient/SqlDataReader.cs
1309 317 2
private bool TryReadInternal()
in System.Data/fx/src/data/System/Data/SqlClient/SqlDataReader.cs
1309 317 2
internal static string MapSecurityStatus()
in System/net/System/Net/_SecureChannel.cs
299 295 1
int yyparse()
in System.Data.Entity/System/Data/Common/EntitySql/CqlParser.cs
1439 261 0
internal static int InferSimpleType()
in System.Xml/System/Xml/Schema/Inference/Infer.cs
604 225 2
public StringBuilder Append()
in mscorlib/system/text/stringbuilder.cs
1120 217 3
private object EvalBinaryOp()
in System.Data/System/Data/Filter/BinaryNode.cs
518 215 6
private object EvalBinaryOp()
in System.Data/fx/src/data/System/Data/Filter/BinaryNode.cs
518 215 6
override public void Close()
in System.Data/System/Data/SqlClient/SqlConnection.cs
1244 212 0
override public void Close()
in System.Data/fx/src/data/System/Data/SqlClient/SqlConnection.cs
1244 212 0
void ImportAccessorMapping()
in System.Xml/System/Xml/Serialization/XmlReflectionImporter.cs
415 178 8
internal void GenerateOneCode()
in System/regex/system/text/regularexpressions/RegexCompiler.cs
984 178 0
private unsafe void FetchCacheControl()
in System/net/System/Net/Cache/HttpRequestCacheValidator.cs
222 169 2
private static bool IsExplicitNumericConversion()
in System.Workflow.Activities/Rules/RuleValidation.cs
229 159 2
Public Overrides Function BindToMethod()
in Microsoft.VisualBasic/runtime/msvbalib/Helpers/VBBinder.vb
697 156 2
private SqlNode VisitSequenceOperatorCall()
in System.Data.Linq/SqlClient/Query/QueryConverter.cs
285 150 1
internal Task TdsExecuteRPC()
in System.Data/System/Data/SqlClient/TdsParser.cs
460 149 11