DEV Community

loading...

Algorithms behind RuboCop complexity metrics

avmnusng profile image Abhimanyu Singh ・1 min read

I published a series on Medium.com, explaining the algorithms behind RuboCop complexity metrics. The third part reveals the mathematical connections between different metrics. The series will help you with configuring cyclomatic complexity, perceived complexity, and, ABC size values for RuboCop analysis, which are not completely random.

  • In the first part we cover syntactic representation of Ruby source code. It provides all the information required to get started with the algorithms.
  • In the second part we go through the pseudocode of the algorithms and solve a couple of problems to see how to calculate the complexity values without drawing control flow graphs.
  • In the third part we do mathematical analysis to establish a relationship between the metrics and not use a random RuboCop configuration.

I would love your feedback. Thanks!

Discussion

pic
Editor guide