File Complexity Overall
  • There are 2,070 files with units, with 163,218 lines of code.
    • 0 very complex files (McCabe index sum 251+; 0 lines of code)
    • 1 complex files (McCabe index sum 126-250; 478 lines of code)
    • 2 medium complex files (McCabe index sum 51-125; 473 lines of code)
    • 7 slightly complex files (McCabe index sum 26-50; 1,668 lines of code)
    • 2,060 simple files (McCabe index sum 1-25; 160,599 lines of code)
  • 1,384 main files have no units (e.g. languages without unit analysis, or files without functions) and are not classified.
system0% | <1% | <1% | 1% | 98%
Legend:
251+
126-250
51-125
26-50
1-25


explore: grouped by folders | grouped by complexity
File Complexity per Extension
251+
126-250
51-125
26-50
1-25
rb0% | 2% | 2% | 6% | 88%
rbi0% | 0% | 0% | <1% | 99%
File Complexity per Logical Decomposition
primary
251+
126-250
51-125
26-50
1-25
lib0% | 2% | 2% | 6% | 88%
rbi0% | 0% | 0% | <1% | 99%
Most Complex Files (Top 50)

The McCabe index of a file grows with its size: per 100 lines tells a large but plain file from a dense one, and most complex unit whether the complexity sits in one unit or is spread over many.

File# lines# unitsMcCabe index
(sum)
per 100
lines
most complex
unit
refusal_fallback.rb
in lib/anthropic/helpers
478 28 145 30 28
config_provider.rb
in lib/anthropic/credentials
275 21 76 28 11
client.rb
in lib/anthropic
198 7 56 28 33
base_model.rb
in lib/anthropic/internal/type
285 14 41 14 12
credentials.rbi
in rbi/anthropic
215 33 33 15 1
util.rb
in lib/anthropic/internal
294 21 32 11 5
middleware.rb
in lib/anthropic
168 14 31 18 5
pooled_net_requester.rb
in lib/anthropic/internal/transport
168 7 31 18 9
base_client.rb
in lib/anthropic/internal/transport
448 9 30 7 18
constants.rb
in lib/anthropic/credentials
90 10 29 32 6
base_model.rbi
in rbi/anthropic/internal/type
229 24 24 10 1
mcp.rb
in lib/anthropic/helpers/tools
323 12 24 7 5
runner.rb
in lib/anthropic/helpers/tools
349 10 22 6 7
credentials.rb
in lib/anthropic
82 3 20 24 11
token_cache.rb
in lib/anthropic/credentials
99 5 19 19 11
messages.rb
in lib/anthropic/resources
118 7 18 15 5
converter.rb
in lib/anthropic/internal/type
174 8 18 10 9
client.rb
in lib/anthropic/helpers/google_cloud
118 2 18 15 17
config.rb
in lib/anthropic/credentials
62 6 18 29 8
workload_identity.rb
in lib/anthropic/credentials
122 8 18 15 5
middleware.rbi
in rbi/anthropic
287 17 17 6 1
union.rb
in lib/anthropic/internal/type
123 7 17 14 7
beta_spend_summary.rb
in lib/anthropic/models/beta/organization
115 3 17 15 7
event_accumulator.rb
in lib/anthropic/helpers/sessions
74 6 16 22 9
client.rb
in lib/anthropic/helpers/bedrock
165 4 15 9 12
credentials_file.rb
in lib/anthropic/credentials
71 7 15 21 8
util.rbi
in rbi/anthropic/internal
117 14 14 12 1
messages.rb
in lib/anthropic/helpers
174 3 14 8 7
hash_of.rb
in lib/anthropic/internal/type
80 7 13 16 3
beta_web_fetch_url_sources.rb
in lib/anthropic/models/beta
91 3 13 14 5
beta_managed_agents_error.rb
in lib/anthropic/models/beta/memory_stores
71 1 13 18 13
raw_content_block_start_event.rb
in lib/anthropic/models
70 1 13 19 13
content_block.rb
in lib/anthropic/models
65 1 13 20 13
web_fetch_url_sources.rb
in lib/anthropic/models
88 3 13 15 5
in_memory_config.rb
in lib/anthropic/credentials
60 4 13 22 5
array_of.rb
in lib/anthropic/internal/type
61 6 12 20 4
client.rb
in lib/anthropic/helpers/vertex
139 3 12 9 10
beta_spend_summary.rbi
in rbi/anthropic/models/beta/organization
374 11 11 3 1
batch_create_params.rbi
in rbi/anthropic/models/beta/messages
799 11 11 1 1
beta_web_fetch_url_sources.rbi
in rbi/anthropic/models/beta
352 11 11 3 1
web_fetch_url_sources.rbi
in rbi/anthropic/models
324 11 11 3 1
beta_dreaming_error.rb
in lib/anthropic/models/beta
60 1 11 18 11
identity_token_file.rb
in lib/anthropic/credentials
38 3 11 29 5
beta_plugin.rbi
in rbi/anthropic/models/beta/organization
410 10 10 2 1
errors.rb
in lib/anthropic
141 6 10 7 3
token_page.rb
in lib/anthropic/internal
47 5 10 21 3
page.rb
in lib/anthropic/internal
50 5 10 20 3
beta_error.rb
in lib/anthropic/models
53 1 10 19 10
error_object.rb
in lib/anthropic/models
53 1 10 19 10
base_tool.rb
in lib/anthropic/helpers/tools
57 6 10 18 4
About This Analysis
  • File complexity is the sum of the McCabe indexes (conditional complexity) of the units (methods, functions...) in a file.
  • Files are classified in five categories based on that sum: 1-25 (simple files), 26-50 (slightly complex files), 51-125 (medium complex files), 126-250 (complex files), 251+ (very complex files). The default bands are five times the unit complexity bands, as a file is a group of units.
  • Only main code files with units are classified. Files without units (languages without unit analysis, or files without functions) have no complexity to measure and are left out rather than counted as simple.
  • A very complex file holds many decisions, which often means it has too many responsibilities: a candidate to split, and a place where changes need more testing.
Learn more...