{"slug": "ai-code-is-spaghetti-right", "title": "AI code is spaghetti. Right?", "summary": "A developer built Spaghetti Meter, a tool that scans a project folder for code-quality problems and visualizes the results as spaghetti filling a bowl, with a score of about 100 overflowing it. After testing it on AI-generated and human-written repositories, the developer found some presumed human-written codebases scored unexpectedly high, then revised the scoring to use analyzed lines of code instead of file counts and to dampen repeated findings. The updated calculation was run across twelve projects covering roughly 25,000 files and 7 million lines, but the developer cautioned that the changes were made after seeing unexpected results and do not constitute a fair comparison.", "body_md": "I built a little tool called Spaghetti Meter to look for spaghetti code in a project. You select a folder, it scans the supported code for problems, and shows what it finds as spaghetti falling into a bowl. The higher the score, the fuller the bowl gets. Around 100 fills it, and after that it starts overflowing.\n\nI thought it would be a fun thing to show other developers. Feed it some AI-generated projects, watch the bowl overflow, have a laugh about the mess we're creating.\n\nI was pretty sure I knew how that would go.\n\nThe projects I guessed were mostly AI-written got high scores. But some repos I believed were originally built without AI scored surprisingly high too.\n\nThat was the bit I hadn't expected.\n\nThat doesn't mean I know who wrote all that code. “Mostly AI” was my impression, not something I'd measured. The same goes for my assumptions about the human-written projects. A contribution policy isn't an authorship record, and these weren't matched projects.\n\nSo I went back to the calculation. The first version used findings per file mixed with the total number of findings. I started wondering how much of the score came from the code being messy, and how much came from project size or the way someone had split up their files.\n\nI changed it to use the amount of code actually analyzed instead of file counts. I also reduced how much repeated findings contribute. If the same rule keeps firing in the same file, those findings still count, but they don't keep pushing the score up at the same rate. Naming, style, and security findings still count too.\n\nThose changes made sense to me, but I did make them after seeing results I didn't expect. I'm not going to pretend that gives me a fair comparison all of a sudden.\n\nTo see how the updated calculation behaved across different codebases, I ran a small batch of ~25,000 supported files and ~7 million analyzed code lines across twelve projects.\n\n| Project | AI policy | Code lines | CB findings | Undiminished | App score | \n|---|---|---|---|---|---|\n| [VoiceStudio](https://github.com/debpalash/VoiceStudio/tree/8f6c113433faa1c39d0584534d7d20f469a2a419) | [Allowed, with conditions](https://github.com/debpalash/VoiceStudio/blob/8f6c113433faa1c39d0584534d7d20f469a2a419/.github/CONTRIBUTING.md#contributing-with-ai-agents) | 283,220 | 2,605 | 159 | 143 | \n| [T3 Code](https://github.com/pingdotgg/t3code/tree/3b4041a97a5ca84c4b8a3dac71287cf82190c7a7) | [Allowed, with conditions](https://github.com/pingdotgg/t3code/blob/3b4041a97a5ca84c4b8a3dac71287cf82190c7a7/CONTRIBUTING.md#models) | 1,081,944 | 3,044 | 37 | 34 | \n| [Deno](https://github.com/denoland/deno/tree/d8c551b5a5b46d8ec3892a91d0364cfcbca2c681) | [Allowed, with conditions](https://github.com/denoland/deno/blob/d8c551b5a5b46d8ec3892a91d0364cfcbca2c681/.github/CONTRIBUTING.md) | 591,608 | 5,211 | 237 | 180 | \n| [Zed](https://github.com/zed-industries/zed/tree/f693ad0847e4faacd7d630fc78c54695bb862266) | [Allowed, with conditions](https://github.com/zed-industries/zed/blob/f693ad0847e4faacd7d630fc78c54695bb862266/CONTRIBUTING.md#ai-policy) | 967,391 | 6,253 | 182 | 132 | \n| [Bevy](https://github.com/bevyengine/bevy/tree/779770720e6ad916c1de38cf66a67d0e079ed1e3) | [Allowed, with conditions](https://github.com/bevyengine/bevy-website/blob/55d698a34d6f325885f5998667b3402d93acd55f/content/learn/contribute/policies/ai.md) | 323,930 | 2,187 | 192 | 153 | \n| [AnyPS5](https://github.com/boykopovar/AnyPS5/tree/40206fe50daa1eca5ba72fe2da70bd505efe977f) | [Allowed, with conditions](https://github.com/boykopovar/AnyPS5/blob/40206fe50daa1eca5ba72fe2da70bd505efe977f/CONTRIBUTING.md#branches-and-pull-requests) | 730,593 | 6,289 | 108 | 90 | \n| [QEMU](https://github.com/qemu/qemu/tree/08c9bbb825148dec9669f5184ecf18823bb6d631) | [Restricted](https://github.com/qemu/qemu/blob/08c9bbb825148dec9669f5184ecf18823bb6d631/docs/devel/code-provenance.rst#use-of-ai-generated-content) | 1,687,027 | 6,338 | 52 | 46 | \n| [OpenTTD](https://github.com/OpenTTD/OpenTTD/tree/a6f6d83a608b25880096e7c35e22e650fe82b9d5) | [Restricted](https://github.com/OpenTTD/OpenTTD/blob/a6f6d83a608b25880096e7c35e22e650fe82b9d5/CONTRIBUTING.md#use-of-ai) | 248,109 | 1,895 | 99 | 86 | \n| [fish](https://github.com/fish-shell/fish-shell/tree/f0d874ad924bd582a039f5a5d5a018913c7d8b6a) | [Restricted](https://github.com/fish-shell/fish-shell/blob/f0d874ad924bd582a039f5a5d5a018913c7d8b6a/CONTRIBUTING.rst#ai-contributions-policy) | 78,773 | 1,462 | 541 | 410 | \n| [SDL](https://github.com/libsdl-org/SDL/tree/0026fc7fee46d8e474ab87cb1d8b98d1eee460ed) | [Restricted](https://github.com/libsdl-org/SDL/blob/0026fc7fee46d8e474ab87cb1d8b98d1eee460ed/.github/PULL_REQUEST_TEMPLATE.md) | 540,598 | 2,646 | 65 | 54 | \n| [stb](https://github.com/nothings/stb/tree/033efa1bcb750136ac98e997d53833b758e0089b) | [Restricted](https://github.com/nothings/stb/blob/033efa1bcb750136ac98e997d53833b758e0089b/CONTRIBUTING.md) | 59,741 | 417 | 98 | 81 | \n| [Cataclysm-DDA](https://github.com/CleverRaven/Cataclysm-DDA/tree/2238c719badac8d6d25063d18538659874e5bb36) | [Restricted](https://github.com/CleverRaven/Cataclysm-DDA/blob/2238c719badac8d6d25063d18538659874e5bb36/CONTRIBUTING.md#licensing-and-authorship) | 663,559 | 4,775 | 100 | 79 | \n\nThe policies are linked, including their conditions. They still aren't proof of who wrote the existing code. CB findings include actionable findings and advisories, not just confirmed bugs.\n\n“Undiminished” counts every repeat like the first finding. “App score” is what Spaghetti Meter actually shows, with repeated findings contributing less. Both use the same analyzed code lines.\n\nEvery project was checked out at the linked commit and scanned twice with the same native CB build:\n\n```\ncb review --advisory --verbose --no-cache --allow-empty --format=json --root /path/to/repo\n```\n\nThis was a local development build based on Code Buster 0.14.5. App scores come from the [Spaghetti Meter 0.1.5](https://github.com/tool-bunker/spaghetti-meter/).\n\nRepository settings and normal source classification were respected. Tests, examples, generated and vendored files weren't forced into the scans. No project dependencies or build scripts were run. The repeated scans check consistency, not accuracy or speed; filesystem caches weren't flushed.\n\nI haven't corrected the table by hand or gone through every finding. These are the raw outputs, including the tool's mistakes.\n\nThe app uses my static analyzer, [Code Buster](https://github.com/tool-bunker/code-buster), underneath. If that reports something incorrectly, the spaghetti score inherits the mistake. And even when a finding is technically correct, it might be pointing at something that's perfectly reasonable for that particular project.\n\nMaybe I've built it to prefer standard structures and familiar conventions. And maybe AI is quite good at producing exactly the sort of code my rules like, even if that doesn't make it nicer for a person to read. I don't know. That's something I need to look into, not another conclusion to draw from these scores.\n\nDifferent languages also get different rule coverage, and the scan doesn't necessarily cover the whole repo. An older project carrying years of compatibility code isn't the same thing as a new project built for one narrow job. There are a lot of things here that a single number won't explain.\n\nI still want to believe human code is easier to read. Maybe it is and my tool isn't measuring the things that make the difference. Or maybe I'm wrong about some of this.\n\nEither way, I thought it was worth sharing rather than only showing results that agreed with me. It wasn't the result I wanted, but it gave me a few things to question about what I'd built.\n\nI'll keep working on Code Buster and Spaghetti Meter, trying to make them faster and sorting out more false positives. For now, please take this as a conversation starter, not something to quote in the next argument about whether AI or humans write better code.\n\nIf you want to try it, here's [Spaghetti Meter](https://toolbunker.dev/spaghetti-meter/) or you could just go with [Code Buster](https://github.com/tool-bunker/code-buster) instead.\n\nI'd be interested in seeing where it gets your project wrong. Is it finding something genuinely messy, or just complaining about a way of writing code it doesn't understand?", "url": "https://wpnews.pro/news/ai-code-is-spaghetti-right", "canonical_source": "https://dev.to/robertsson/ai-code-is-spaghetti-right-59lp", "published_at": "2026-11-20 21:05:02+00:00", "updated_at": "2026-11-20 21:14:56.577426+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents"], "entities": ["Spaghetti Meter", "VoiceStudio", "T3 Code", "Deno", "Zed", "Bevy", "AnyPS5", "QEMU"], "also_reported_by": [], "takeaway": "Scoring code quality by findings-per-file conflates messiness with project size and file splitting; switching to analyzed lines of code and damping repeated findings across twelve projects (~25,000 files, ~7 million lines) produced markedly lower scores.", "recommendation": {"advice": "Normalize code-quality scores by analyzed lines of code rather than file counts, and dampen repeated findings in the same file so project size doesn't inflate the result.", "playbook": "evals-testing", "playbook_url": "https://wpnews.pro/playbooks/evals-testing"}, "alternates": {"html": "https://wpnews.pro/news/ai-code-is-spaghetti-right", "markdown": "https://wpnews.pro/news/ai-code-is-spaghetti-right.md", "text": "https://wpnews.pro/news/ai-code-is-spaghetti-right.txt", "jsonld": "https://wpnews.pro/news/ai-code-is-spaghetti-right.jsonld"}}