I was looking for the best way to measure code quality and I found it. Here is the scientific presentation of the formula.

I think many coders out there will agree that this is definitely a good way!