This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # Cyclomatic complexity analyzer for Ruby methods. | |
| # | |
| # Counts the number of linearly independent paths through a method by | |
| # starting at 1 and adding 1 for each decision point: | |
| # - conditionals : if, elsif, unless (including postfix forms), ternary ?: | |
| # - loops : while, until, for (including postfix forms) | |
| # - case/rescue : each `when` clause, each `rescue` clause | |
| # - boolean ops : &&, ||, and, or | |
| # - safe nav : &. (each call may short-circuit, so it's a branch) |