Method policy_version_sentence
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def policy_version_sentence(version)
changes = []
case version.event
when "create"
- 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 policy_version_sentence_text
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def policy_version_sentence_text(version)
case version.event
when "create"
name = version.changeset["name"].second
description = version.changeset["description"].second
- 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 policy_version_sentence_text
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def policy_version_sentence_text(version)
case version.event
when "create"
name = version.changeset["name"].second
description = version.changeset["description"].second
Method policy_version_sentence
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def policy_version_sentence(version)
changes = []
case version.event
when "create"
Method policy_division_version_sentence
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def policy_division_version_sentence(version)
vote = policy_division_version_vote(version)
division = policy_division_version_division(version)
division_link = content_tag(:em, link_to(division.name, division_url_simple(division)))
out = []
Method randomise_people_voting_on_policy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def randomise_people_voting_on_policy(policy)
distances = policy.policy_person_distances.currently_in_parliament.includes(:person, person: :members)
# Insert people into each category
people_category_table = {}
- 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"