Showing 4 of 4 total issues
Class Parser
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Parser
def initialize(node)
@node = node
end
Method classification
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def classification
case
when event_description.match(deflected_by_regex("first baseman")) then "1B"
when event_description.match(deflected_by_regex("second baseman")) then "2B"
when event_description.match(deflected_by_regex("third baseman")) then "3B"
Method classification
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def classification
case
when event_description.match(/line(s)? (drive|into|out)/)
"Line drive"
when event_description.match(/fl(ies|y) (ball|out)/)
Method parse_hit_from_description
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse_hit_from_description
description = node.attribute("des").value
if description.match(/singles/)
@h = 1
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"