Showing 65 of 108 total issues
Method dashboard
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def dashboard
@new_proposal = co.proposals.new
case co
- 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 create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create
@association = Association.new(params[:association])
@founder = Member.new(params[:founder])
errors = []
- 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 to_pdf
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def to_pdf
template = File.expand_path(File.join(Rails.root, 'data', 'pdf_form_filler', 'fca_2014', 'mutuals-new-ip-form.pdf'))
definition = File.expand_path(File.join(Rails.root, 'data', 'pdf_form_filler', 'fca_2014', 'mutuals-new-ip-form.yml'))
# Load default filled-in data for form
- 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 create_default_member_classes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_default_member_classes
members = member_classes.find_or_create_by_name('Member')
members.set_permission!(:resolution_proposal, true)
members.set_permission!(:vote, true)
Method index
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
case co
when Association
@page_title = "Members"
@members = co.members.active
Method create
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
HANDLED_RESOLUTION_TYPES.each do |resolution_type|
if params[resolution_type]
resolution_class = co.send(resolution_type.to_s.pluralize)
resolution_parameters = params[resolution_type] || {}
Method create
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@commentable = if params[:proposal_id]
co.proposals.find(params[:proposal_id])
elsif params[:meeting_id]
co.meetings.find(params[:meeting_id])
Method generate_pdf
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_pdf(filename='Download', options={})
options = {
:header_right => "Printed on #{Time.now.utc.to_s(:long_date)}",
:header_line => true
}.with_indifferent_access.merge(options)
Method after_initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def after_initialize
# Load existing settings from organisation, if given, but don't
# overwrite new settings that have been passed directly in as attributes.
if organisation
case organisation
Method name_for_value
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.name_for_value(value)
value = value.to_i
case value
when 0..3600
minutes = (value / 60.0).round
- 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 prepare_notifications
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def prepare_notifications
return unless current_user
# If you have a notification you want to show the user, put the
# logic in here, and the template in shared/notifications.
- 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 passed_resolutions_attributes=
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def passed_resolutions_attributes=(attributes)
@resolutions_to_pass = []
@resolutions_to_record_additional_votes = []
attributes.values.each do |v|
- 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 generate_csv
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_csv
case co
when Association
# Only Associations use the 'inducted_at' field.
headers = ["First name", "Last name", "Email", "Date joined", "Time of last login"]
Method after_initialize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def after_initialize
# TODO ? only use constitution's original values as defaults; allow
# new values to be passed in via the attributes
case organisation
when Association
Method edit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def edit
@page_title = "Amendments"
case co
when Association
- 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 notify_foundation_decision
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def notify_foundation_decision(member, decision)
default_url_options[:host] = member.organisation.domain(:only_host => true)
@decision = decision
@member = member
- 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 create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
HANDLED_RESOLUTION_TYPES.each do |resolution_type|
if params[resolution_type]
resolution_class = co.send(resolution_type.to_s.pluralize)
resolution_parameters = params[resolution_type] || {}
- 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 create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
@commentable = if params[:proposal_id]
co.proposals.find(params[:proposal_id])
elsif params[:meeting_id]
co.meetings.find(params[:meeting_id])
- 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 attributes_for_resolutions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def attributes_for_resolutions
result = []
[:user, :employee, :supporter, :producer, :consumer].each do |member_type|
method = member_type.to_s + '_members'
if send(method) == '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"
Further reading
Method after_transition
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def after_transition(member, transition)
case transition.event
when :induct
case member.organisation
when Coop
- 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"