Showing 65 of 108 total issues
Method member_count_for_proposal
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def member_count_for_proposal(proposal)
# TODO: find out how to do the following in one query
count = 0
# To vote, a member must be inducted, and must have been added (created)
- 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_initialize
has a Cognitive Complexity of 8 (exceeds 5 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
- 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 run_daily_job
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.run_daily_job
# Find all Coop members who have not attained the minimum shareholding within 12 months
# of membership.
all.each do |coop|
if !coop.single_shareholding && coop.minimum_shareholding
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def create
authorize! :create, ConstitutionProposalBundle
@constitution_proposal_bundle = co.build_constitution_proposal_bundle(
params[:constitution_proposal_bundle]
- 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 creation_success_message
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def creation_success_message
if open?
"A proposal to #{notice_period_increased? ? 'increase' : 'decrease'} the General Meeting notice period has been opened for electronic voting."
elsif draft?
"A draft proposal to #{notice_period_increased? ? 'increase' : 'decrease'} the General Meeting notice period has been saved."
- 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 find_templates
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_templates(name, prefix, partial, details, _)
Method after_initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def after_initialize
[
:user_members, :employee_members, :supporter_members, :producer_members, :consumer_members
].each do |clause_name|
send("#{clause_name}=", !!organisation.constitution.send(clause_name) ? '1' : '0') unless send(clause_name)
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def attributes_for_resolutions
if single_shareholding == '1'
title = "Change the Rules to permit each Member to hold only one share"
new_value = true
else
- 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 build_participants_from_participant_ids
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_participants_from_participant_ids
return unless participant_ids && participant_ids.respond_to?(:keys)
unless organisation
raise RuntimeError, "Tried to save participant_ids without setting organisation"
- 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 document
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def document
# TODO Make this work for Organisation subclasses other than Coop.
if document_template
document = document_template
elsif document_id = Setting[:coop_constitution_document_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 create_election_if_necessary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_election_if_necessary
return if election
return unless electronic_nominations || electronic_voting
build_election(:organisation => organisation)
- 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 cast_to_boolean
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def cast_to_boolean(value)
if value == 'true'
true
elsif value == 'false'
false
- 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 set_member_class_of_officer_if_necessary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_member_class_of_officer_if_necessary
if office && office.title == "Secretary"
if officer
secretary_member_class = officer.organisation.member_classes.find_by_name("Secretary")
officer.update_attribute(:member_class, secretary_member_class) if secretary_member_class
- 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 track_analytics_event
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def track_analytics_event(event_name, options={})
return unless Rails.env.production? && OneClickOrgs::GoogleAnalytics.active?
if options[:now]
@analytics_events ||= []
@analytics_events.push(event_name)
- 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 cast_vote
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def cast_vote(action, proposal)
raise ArgumentError, "need action and proposal" unless action and proposal
existing_vote = Vote.where(:member_id => self.id, :proposal_id => proposal.id).first
raise VoteError, "Vote already exists for this proposal" if existing_vote
- 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_initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def after_initialize
if new_record?
if organisation && organisation.respond_to?(:meeting_notice_period)
self.happened_on ||= Date.today.advance(:days => organisation.meeting_notice_period)
end
- 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_create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def after_create(member)
case member.organisation
when Coop
if member.organisation.active?
send_new_member_notification(member) if member.pending?
- 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
Function activateLightbox
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
OneClickOrgs.activateLightbox = function (options) {
var completionCallback, lightboxSelector;
if (options && options.complete) {
completionCallBack = options.complete;
}
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def attributes_for_resolutions
if common_ownership == '1'
title = "Change the organisation to be a Common Ownership enterprise"
new_value = true
else
- 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 vote_for
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def vote_for
authorize! :create, Vote
id, return_to = params[:id], params[:return_to]
raise ArgumentError, "need proposal id" unless 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"