Method guess_division_scope
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def guess_division_scope(office, division)
if office.is_governor? ||
(office.is_federal_legislator? &&
office.roles.include?("legislatorUpperBody"))
GoogleCivicInfo::Division::STATEWIDE
- 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"
Further reading
Method legacy_skip_for_now
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def legacy_skip_for_now(office, division)
(office.level == "county" && (office.name.downcase != "mayor" &&
!office.name.downcase.include?("council"))) ||
(office.level == "federal" && division.scope == "national") ||
((office.level == "city" || office.level == "other") &&
- 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"
Further reading
Method jurisdiction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def jurisdiction
return jurisdiction_from_scope if legacy?
jurisdiction = state
if division.is_county?
- 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"
Further reading
Method guess_office_level
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def guess_office_level(office, division)
if office.is_governor? || office.is_state_legislator?
GoogleCivicInfo::Office::STATE
elsif office.is_federal_legislator? || office.is_federal_executive_or_judicial?
GoogleCivicInfo::Office::FEDERAL
- 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"