Live data from Hacker News

Ask HN: Is there a metric for AI code quality?

news.ycombinator.com

1–10 of 12 posts

Ask HN: Is there a metric for AI code quality?

#1
I've tried many different models and without doubt the code coming out of them differs a lot when it comes to "quality". Some of that is subjective for sure, but there are objective sides to "good" code.

I wish this was a metric for the AI benchmarks so I could choose a model based on this, because honestly it's one of the things I care most about.

Problem: How can you measure such things, whats the metrcis?

...maybe there just isn't a way to do it, since that metric isn't in the charts..

Re: Ask HN: Is there a metric for AI code quality?

#3
Not sure if I got the question right, but there are benchmarks like SWE pro and stuff. There's whole another debate whether you can trust it or not, and whether the labs are training on those benchmarks, but that's one way to measure that.

Other than benchmarks, I'd say that's your own test suite

Re: Ask HN: Is there a metric for AI code quality?

#4

Not sure if I got the question right, but there are benchmarks like SWE pro and stuff. There's whole another debate whether you can trust it or not, and whether the labs are training on those benchmarks, but that's one way to measure that. Other than benchmarks, I'd say that's your own test suite

i would never trust benchmarks tbh most of the new model releases do benchmaxxing

Re: Ask HN: Is there a metric for AI code quality?

#5
post #4

Not sure if I got the question right, but there are benchmarks like SWE pro and stuff. There's whole another debate whether you can trust it or not, and whether the labs are training on those benchmarks, but that's one way to measure that. Other than benchmarks, I'd say that's your own test suite

i would never trust benchmarks tbh most of the new model releases do benchmaxxing

Sad, but fair!

Re: Ask HN: Is there a metric for AI code quality?

#7
I don't think there's a good objective metric here, at least not like cyclomatic complexity or SonarQube-style checks, because it's difficult to tell whether the code is overcomplicated by AI, or whether the domain itself is just complicated.

Code is derivative - it's modeling real behavior. So its quality depends closely on how well it captures what should actually happen.

That's why measuring the actual outcome is more important than raw "code quality" metrics: do the important user flows and edge cases work, how the system behaves in these edge cases. I'd more use something like Journey SDK to fuzz edge cases and measure how well the system behaves, rather than measure some arbitrary properties of the code.

Re: Ask HN: Is there a metric for AI code quality?

#9
I am not sure mate. I occasionally use Claude Code /ultrareview or /code-review to have the code thoroughly checked, and I also use my OSS project git-aftermerge to check if LLM is making a same mistake or something (Or you could just use CLAUDE.md to memorise that). I am looking into Langsmith and Braintrust to see if code output can be more stable and with higher quality.
Post reply on HN