I was helping out my friend who’s rubocop was complaining on ABC complexity on a method to format a range where either the lower or upper bound or both might be absent. Here was my solution that finally solved it, but here is where I simply wonder if the hoops we jump through to make static code analyzer’s happier isn’t always leading to more readable/maintainable code. You tell me, which is better?
The examples have been simplified to remove implementation details not important to this discussion. example.rb
satisfies Rubocop while original.rb
gets flagged for ABC complexity.