Skip to content

Instantly share code, notes, and snippets.

@al-maisan
Last active March 6, 2026 13:43
Show Gist options
  • Select an option

  • Save al-maisan/80bc9ea7e780f5dcf6bad4bb7570baea to your computer and use it in GitHub Desktop.

Select an option

Save al-maisan/80bc9ea7e780f5dcf6bad4bb7570baea to your computer and use it in GitHub Desktop.
complexity-report.md

Codebase Complexity Report

Date: 2026-03-06

Overview (scc)

Metric Value
Total Rust files 75
Total lines 15,673
Code lines 13,272
Comment lines 682
Blank lines 1,719
Total complexity (scc) 777
Estimated cost (COCOMO) $408,017
Estimated schedule 9.78 months
Estimated people 3.71

Per-Function Cognitive Complexity (complexity crate)

185 functions with complexity > 0. Top 30:

Score File Function
86 notifications/types/condition/mod.rs from_str
59 http/api/protected/async_pvp/mod.rs submit_leg
41 notifications/types/condition/mod.rs is_valid
35 season/mod.rs run_season_processing
28 notifications/aws_sns.rs send_rendered
27 notifications/daily_notifications.rs run
23 mission/types/category_unlock.rs progress_mission
23 http/api/public/reg.rs dev_token
20 season/mod.rs coins_for_percentile
18 notifications/templates.rs render
16 services/job_queue.rs execute_job
16 http/session.rs get
15 season/cache.rs redis_subscriber_loop
14 services/job_queue.rs worker_loop
13 db/users.rs update_username
13 db/users.rs insert
12 notifications/types/condition/mod.rs from_str (inner)
12 http/api/protected/friends.rs add_with_code
11 http/api/protected/async_pvp/mod.rs question_data
11 db/async_pvp/types.rs conclude_expired
10 services/job_queue.rs reaper_loop
10 http/middleware/last_online/cache.rs update_user_last_online
10 http/api/protected/mission.rs get_daily
10 http/api/protected/async_pvp/mod.rs start_random_game
10 http/api/protected/async_pvp/mod.rs get_single
9 mission/types/daily_login.rs try_progress
9 http/api/protected/async_pvp/mod.rs pick_category
7 season/mod.rs process_rewards
7 notifications/types/condition/operators.rs apply
7 notifications/templates.rs load

Per-File Complexity (scc)

Complexity Code File
97 1,225 http/api/protected/async_pvp/mod.rs
84 1,231 notifications/types/condition/mod.rs
50 297 notifications/types/condition/operators.rs
42 479 season/mod.rs
28 289 db/async_pvp/types.rs
27 225 mission/types/category_unlock.rs
26 281 services/job_queue.rs
23 389 http/api/protected/friends.rs
23 551 db/types.rs
21 370 mission/types/daily_login.rs
20 229 notifications/templates.rs
20 184 season/cache.rs
19 220 mission/types/daily_high_score.rs
18 313 db/users.rs
17 194 notifications/daily_notifications.rs
17 255 notifications/aws_sns.rs
17 295 mission/mod.rs

Clippy Cognitive Complexity (threshold 25)

Only 3 functions exceed clippy's default threshold:

Score Location Function
37 http/api/protected/async_pvp/mod.rs:232 submit_leg
30 season/cache.rs:152 redis_subscriber_loop
27 season/mod.rs:160 run_season_processing

Hot Spots

Complexity concentrates in three areas:

  1. Notification condition enginecondition/mod.rs has the single most complex function (from_str at 86) plus is_valid at 41. This is a custom expression parser/evaluator with deep nesting. The file is tied for largest at 1,468 lines.

  2. Async PvPasync_pvp/mod.rs has submit_leg at 59 and 5 other functions in the top 25. This is a game state machine with many branching paths. Tied for largest file.

  3. Season processingseason/mod.rs contributes run_season_processing at 35. Season state transitions and reward processing drive the complexity.

Assessment

  • 86 functions (46%) have zero complexity — simple getters, constructors, delegators
  • 74 functions (40%) score 1-9 — straightforward logic
  • 25 functions (14%) score 10+ — the ones worth watching
  • 3 functions score 35+ — candidates for refactoring
  • The from_str parser at 86 is the clear outlier; the rest of the codebase is well-structured
  • For ~16k lines / 185 non-trivial functions, the complexity distribution is healthy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment