Showing 21 of 187 total issues
Method send_doccom_update_email
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def send_doccom_update_email(committee, title)
User.all.each do |user|
if current_user.admin?
NotificationMailer.document_update_email(user, Document.find_by_title(title)).deliver
elsif (committee == "internal" and user.internal?) or (committee == "external" and user.external?) or (committee == "executive" and user.executive?)
- 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 send_announcement_email
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def send_announcement_email(committee, title)
User.all.each do |user|
if current_user.admin?
NotificationMailer.announcement_email(user, Announcement.find_by_title(title)).deliver
elsif (committee == "internal" and user.internal?) or (committee == "external" and user.external?) or (committee == "executive" and user.executive?)
- 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 send_announcement_update_email
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def send_announcement_update_email(committee, title)
User.all.each do |user|
if current_user.admin?
NotificationMailer.announcement_update_email(user, Announcement.find_by_title(title)).deliver
elsif (committee == "internal" and user.internal?) or (committee == "external" and user.external?) or (committee == "executive" and user.executive?)
- 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 send_doccom_email
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def send_doccom_email(committee, title)
User.all.each do |user|
if current_user.admin?
NotificationMailer.document_update_email(user, Document.find_by_title(title)).deliver
elsif (committee == "internal" and user.internal?) or (committee == "external" and user.external?) or (committee == "executive" and user.executive?)
- 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 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@title = event_params[:title]
@location = event_params[:location]
@description = event_params[:description]
@date = event_params[:date]
Method create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create
@title = event_params[:title]
@location = event_params[:location]
@description = event_params[:description]
@date = event_params[:date]
- 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 update
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@event = Event.find params[:id]
@title = event_params[:title]
@date = event_params[:date]
if @title.empty?
Method update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update
@event = Event.find params[:id]
@title = event_params[:title]
@date = event_params[:date]
if @title.empty?
- 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 update_category
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_category
if !current_user.admin
flash[:message] = "Only admins can create categories."
redirect_to root_path and return
end
Method update_category
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_category
if !current_user.admin
flash[:message] = "Only admins can create categories."
redirect_to root_path and return
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 create_category
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_category
if !current_user.admin
flash[:message] = "Only admins can create categories."
redirect_to root_path and return
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 update_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_file
@target_file = Document.find params[:format]
@file = params[:file]
if @file[:title].to_s == "" or @file[:url].to_s == ""
flash[:notice] = "Populate all fields before submission."
- 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_document
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_document
if params[:title].to_s == "" or params[:url].to_s == ""
flash[:notice] = "Populate all fields before submission."
redirect_to new_committee_document_path
elsif !(params[:url]=~/.com(.*)/)
- 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_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_file
@file = params[:file]
if @file[:title].to_s == "" or @file[:url].to_s == ""
flash[:notice] = "Populate all fields before submission."
redirect_to new_file_path
- 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 update_document
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_document
if params[:title].to_s == "" or params[:url].to_s == ""
flash[:notice] = "Populate all fields before submission."
redirect_to new_committee_document_path
elsif !(params[:url]=~/.com(.*)/)
- 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
Consider simplifying this complex logical expression. Open
elsif (committee == "internal" and user.internal?) or (committee == "external" and user.external?) or (committee == "executive" and user.executive?)
if user.digest_pref == "daily"
NotificationMailer.announcement_update_email(user, Announcement.find_by_title(title)).deliver_later!(wait_until: (Time.now.tomorrow.noon - Time.now).seconds.from_now)
elsif user.digest_pref == "weekly"
NotificationMailer.announcement_update_email(user, Announcement.find_by_title(title)).deliver_later!(wait_until: (Time.now.next_week.noon - Time.now).seconds.from_now)
Consider simplifying this complex logical expression. Open
elsif (committee == "internal" and user.internal?) or (committee == "external" and user.external?) or (committee == "executive" and user.executive?)
if user.digest_pref == "daily"
NotificationMailer.new_document_email(user, Document.find_by_title(title)).deliver_later!(wait_until: (Time.now.tomorrow.noon - Time.now).seconds.from_now)
elsif user.digest_pref == "weekly"
NotificationMailer.new_document_email(user, Document.find_by_title(title)).deliver_later!(wait_until: (Time.now.next_week.noon - Time.now).seconds.from_now)
Consider simplifying this complex logical expression. Open
elsif (committee == "internal" and user.internal?) or (committee == "external" and user.external?) or (committee == "executive" and user.executive?)
if user.digest_pref == "daily"
NotificationMailer.document_update_email(user, Document.find_by_title(title)).deliver_later!(wait_until: (Time.now.tomorrow.noon - Time.now).seconds.from_now)
elsif user.digest_pref == "weekly"
NotificationMailer.document_update_email(user, Document.find_by_title(title)).deliver_later!(wait_until: (Time.now.next_week.noon - Time.now).seconds.from_now)
Consider simplifying this complex logical expression. Open
elsif (committee == "internal" and user.internal?) or (committee == "external" and user.external?) or (committee == "executive" and user.executive?)
if user.digest_pref == "daily"
NotificationMailer.announcement_email(user, Announcement.find_by_title(title)).deliver_later!(wait_until: (Time.now.tomorrow.noon - Time.now).seconds.from_now)
elsif user.digest_pref == "weekly"
NotificationMailer.announcement_email(user, Announcement.find_by_title(title)).deliver_later!(wait_until: (Time.now.next_week.noon - Time.now).seconds.from_now)
Method create_announcement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_announcement
@title = announcement_params[:title]
@content = announcement_params[:content]
@type = "dashboard"
Announcement.create!(:title => @title, :content => @content, :committee_type => @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"