tobymao / sqlglot
Code health
Hotspots average 2.4, the place fixes pay off most.
Explore this codebase
- Code health map39hotspots across 275 files
- Ownership27sole-owned files: one author, no second reader
- Architecture7modules, 3 entry points
- Decisions40recorded, of which 0 in force and 40 background
- Refactoring60open opportunities, one per file
- TestsNo coverage report yet. Run your tests with coverage on, then add the report:
AlsoDocsChatFilesKnowledge graphChange couplingCommitsStatsCosts
Do next · 9
9 things worth doing in the week to Oct 26, the last indexed commit, 1 of them now.
Now
- High
Start breaking up __hash__ (CCN 24, 36 lines): first lift lines 864-885
sqlglot/expressions/core.py:864
__hash__ nests deeply; easier to read and change once split; function changed in 4 commits; its file is imported by 20 files, changed 9 times in 90 days.
- gain
- +0.5 health on this file(inferred)
- health recoverable
- +0.5(inferred)
- size
- CCN 24, 36 lines, nests 8 deep
- steps
- 3 (3 mechanical)
Small effort
Worth planning
Tidy the code shape this week's commits left: 16 findings in 7 files
11 commits in the last 7 days added or worsened long, complex or deeply nested code, still open. Start with
sqlglot/optimizer/unnest_subqueries.py(4 findings): tidying it while the change is fresh costs less than after the next one.- code-shape findings
- 16
- files
- 7
- commits
- 11
Medium effortStart breaking up to_node (CCN 77, 235 lines): first lift lines 358-368
sqlglot/lineage.py:358
to_node has many paths; easier to read and change once split, which also removes a duplicate; function changed in 27 commits; its file is imported by 1 file, changed 3 times in 90 days.
- gain
- up to +0.4 health on this file(inferred)
- finding
- Complex method
- size
- CCN 77, 235 lines, nests 5 deep
- severity
- high
Medium effort, worth a checkStart breaking up canonicalize_internal_names (CCN 90, 211 lines)
sqlglot/optimizer/canonicalize_internal_names.py:262
canonicalize_internal_names has many paths; easier to read and change once split; function changed in 10 commits; its file is imported by 1 file, changed 5 times in 90 days.
- gain
- up to +2.6 health on this file(inferred)
- finding
- Complex method
- size
- CCN 90, 211 lines, nests 8 deep
- severity
- high
Medium effort, worth a checkSimplify
_parse_typesinsqlglot/parser.py: tests reach it, and fixes keep landingChanged 93 times in 90 days, and 51 of those commits were bug fixes.
- commits in 90 days
- 93
- bug-fix commits
- 51
- line coverage
- Unknown, no report
- tests that reach it
- 4 test files, call graph(inferred)
Large effort, worth a check
Everything we found
5 areas
Every detector's open count by area. The actions above are the part worth doing.
- Code health1,374 open findingsCriticalChange entropy · sqlglot/parser.py216 findings · 15.8 deducted
- Refactoring60 open opportunitiesLowshow_sql+0.9 health, S effort · sqlglot/generators/mysql.py
- Doc drift3Mediumposts/onboarding.mdLink points at #type-annotation, which posts/onboarding.md no longer declares.
- Decisions0 drifting from the codeMediumsqlglot/parser.pyHigh-churn file with no governing decision
- Ownership27 sole-owned filesMediumtests/dialects/test_singlestore.pyOne author, no second reader