How to measure the code readability of a file?

138 Views Asked by At

I want to determine the readability of the code that was written by an author. Thus, I am looking for a tool compatible with Python that will provide me with such functionality. The input source is a file written in Java or Javascript and the output should be a value of a metric that measures the readability. The tool should work locally and not share the file content with third parties, because it might be confidential.

I tried including other metrics such as the number of methods in the code, the number of lines per method, the number of authors of the code, number of comments, etc. However, I need one value/metric that would cover them all.

1

There are 1 best solutions below

0
Jon Reid On

You're looking for "Cognitive Complexity" which is a measure of "how hard is this to understand?" https://www.sonarsource.com/docs/CognitiveComplexity.pdf