typescript-cheatsheets/react is a community-maintained TypeScript + React reference repository. Hotspots analyzed 12 total functions across the codebase, with no functions reaching critical or high risk bands. The two functions that warrant attention are main in genReadme.mjs and Home in website/src/pages/index.tsx, with activity-weighted risk scores of 4.77 and 4.23 respectively — active but structurally manageable, as long as that fan-out stays in check.
The table below ranks functions by activity-weighted risk — a score that multiplies structural complexity by recent commit frequency. A function that is both hard to understand (high cyclomatic complexity) and actively changing is a higher priority than one that is complex but untouched. CC = cyclomatic complexity (independent execution paths); ND = max nesting depth; FO = fan-out (distinct callees).
Top 5 Hotspots
| Function | File | Risk | CC | ND | FO |
|---|---|---|---|---|---|
main | genReadme.mjs | 4.8 | 3 | — | 6 |
Home | website/src/pages/index.tsx | 4.2 | 3 | — | 3 |
<anonymous> | website/src/pages/index.tsx | 2.0 | 1 | — | — |
typescript-cheatsheets/react is not a codebase in crisis — no functions are in critical or high risk bands. But low structural complexity can quietly accumulate with each commit, and both functions analyzed here have been touched in the past 24 hours.
main — genReadme.mjs
This is the entry point for the readme generation script — the function responsible for orchestrating whatever file reading, templating, and writing produces the repository’s README. With a fan-out of 6, main calls into six distinct functions, making it the coordination hub for the entire generation pipeline. That coupling means a change to any one of those six callees — or a new content section that requires a new callee — passes through this function. It has been touched 3 times in the last 30 days and was last changed 0 days ago, confirming it is actively evolving.
The cyclomatic complexity of 3 is low, which is reassuring, but the long_function pattern flagged here is the concrete concern. A script entry point that grows by accreting new generation steps tends to become a sequential list of operations that is hard to test in isolation — you cannot unit-test one section of the README output without running the whole pipeline. There is no historical defect signal in the commit history. The risk is forward-looking: as the cheatsheet expands, so will this function. The recommendation is straightforward — apply extract-method refactoring to pull each logical generation step (e.g. reading source files, rendering a section, writing output) into its own named function. That keeps main as a true orchestrator rather than an accumulation of inline logic, and makes each step independently testable.
Home — website/src/pages/index.tsx
Home is the root page component for the Docusaurus-based website, responsible for rendering the landing page visitors see first. Its activity-weighted risk score of 4.23 reflects one commit in the last 30 days and a fan-out of 3 — modest coupling into layout or UI primitives. Cyclomatic complexity sits at 3, and max nesting depth is 0, meaning the component has no conditional branching deep enough to obscure its render logic.
Low structural risk, light recent activity, no historical defect pattern in the commit history. One contributor is responsible for all recent changes — worth noting if the website needs updates during a contributor’s absence. No refactoring is warranted now, but if the homepage begins incorporating feature flags, conditional section rendering, or dynamic content fetching, revisiting its structure at that point will be much easier than after complexity has already accumulated.
Key Takeaways
mainingenReadme.mjsis the function most worth watching: 3 commits in 30 days, fan-out of 6, and a long-function pattern signal. Extract each generation step into a named function now, before new content sections make the pipeline harder to isolate and test.Homeinwebsite/src/pages/index.tsxis structurally clean today, but single-author ownership (1 contributor in 90 days) and recent activity mean it should be reviewed if the website scope expands — complexity is easiest to manage before it arrives.- The overall picture is healthy: 12 functions analyzed, zero in critical or high bands, zero in the fire or debt quadrants. The tooling and website layers are the right place to invest a small amount of preventive structure now.
Patterns Found
Antipatterns detected across the top functions in this snapshot:
| Pattern | Occurrences |
|---|---|
long_function | 1 |
These labels belong to two tiers — Tier 1 (structural): complex_branching, deeply_nested, exit_heavy, long_function, god_function. Tier 2 (relational/temporal): hub_function, cyclic_hub, middle_man, neighbor_risk, stale_complex, churn_magnet, shotgun_target, volatile_god.
Reproduce This Analysis
git clone https://github.com/typescript-cheatsheets/react
cd react
git checkout 4f2591cf953c91f383525c64f9f34720d0eace5c
hotspots analyze . --mode snapshot --explain-patterns --force
To run the same analysis on your own codebase, run hotspots analyze . --mode snapshot in any local git repo — no configuration required.
Hotspots highlights structural and activity risk — not “bad code.” Findings are a prioritization aid, not a bug predictor. Editorial policy →