ZugZug2
Re:Ask HN: Given two repos of code, what criteria would you use to gra...
on Tuesday November 15, 2022 @07:29PM (#33617263)
Shorter code, but there's a lower bound at which things get cryptic and ridiculous. You'd want to distinguish between code golf and regular code.
A common metric is cyclomatic complexity, for which lower is usually better (but you'll find exceptions as soon as you enforce upper bounds in a large project). There are also metrics for modularity and cohesion that might be useful, tho I think it depends on the size of the codebase you're comparing.
I would say smaller executable would tend to be better too, but for short programs you might not see a ton of difference. Variable names/comments that match the intent and semantics... Good luck automating that without replacing humans as programmers. Tho for well defined requirements maybe a language model could correlate them somewhat.