I’m imagining something like the Flesch-Kincaid test for source code: https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests<p>I’m assuming it would have to be language-specific.<p>This is particularly interesting for contextualizing terse code, like Gocker shared here recently, which may have readability benefits in its brevity that is undone by use of obscure features and structure (like code golf).<p>Can anyone share existing discussion of this idea?
I believe cyclomatic complexity is related to what you're looking for. <a href="https://en.m.wikipedia.org/wiki/Cyclomatic_complexity" rel="nofollow">https://en.m.wikipedia.org/wiki/Cyclomatic_complexity</a>
There are tools/plug-ins available which try to measure this which could result in less complex and thus more readable code.