Showing 66 of 90 total issues
Method to_s_raw
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_s_raw
# Assume one date only, equal start/end
start_format_list = [nil, :wday, :month, :day, :year, :at, :hour, :min, :suffix, nil]
start_details = time_details(@start_time)
Function bind_proposal_generic_control
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bind_proposal_generic_control(kind, elements) {
if (! elements) {
elements = $('.proposal_'+kind+'_control');
}
elements.removeAttr('disabled').change(function(event) {
Method time_details
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def time_details(t)
# Get the parts for formatting this time, as a hash of
# strings: keys (roughly) match the equivalent methods on DateTime, but only
# relevant keys will be filled in. If relative is true (the default):
# - if it's today, tomorrow, or yesterday, :wday will be eg "today"
- 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 user_favorites_contention_report
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def user_favorites_contention_report
# Prepare
event = OpenConferenceWare::Event.current
proposals = event.proposals.accepted
- 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 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
# @proposal and @event set via #assign_proposal_and_event filter
# If proposal title editing is locked, prevent non-admin from modifying title.
if params[:proposal] && @event.proposal_titles_locked? && ! admin?
Method index
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def index
warn_about_incomplete_event
@kind = :proposals
- 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 user_favorites_contention_report
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def user_favorites_contention_report
# Prepare
event = OpenConferenceWare::Event.current
proposals = event.proposals.accepted
Method related_proposals
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def related_proposals(some_proposals)
[].tap do |related|
parent = self.parent_or_self
for proposal in some_proposals
catch :found do
- 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 index
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
unless @event
flash[:failure] = "Can't display selector votes without an event!"
return redirect_back_or_to(root_path)
end
Method get_current_event_and_assignment_status
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_current_event_and_assignment_status
invalid = false
# Try finding event using params:
event_id_key = controller_name == "events" ? :id : :event_id
Method to_icalendar
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.to_icalendar(items, opts={})
title = opts[:title] || "Schedule"
url_helper = opts[:url_helper]
calendar = Vpim::Icalendar.create2(Vpim::PRODID)
Method can_edit?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def can_edit?(record)
raise ArgumentError, "No record specified" unless record
if logged_in?
if current_user.admin?
- 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 load_from_fixtures
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.load_from_fixtures(overwrite = false)
[].tap do |records|
data = YAML::load(ERB.new(File.read(OpenConferenceWare::Engine.root.join("spec", "fixtures", "open_conference_ware_snippets.yml"))).result(binding))
for attributes in data.values
record = self.find_by_slug(attributes["slug"].to_s)
- 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 base_show
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def base_show
if selector? && @event.accept_selector_votes?
@selector_vote = @proposal.selector_votes.find_or_initialize_by(user_id: current_user.id)
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 subnav_kind
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def subnav_kind
if @event
if @event.proposal_status_published?
proposal_related_action? ? :proposals : :sessions
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
Function activate_menu_item
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function activate_menu_item () {
var should_log = false;
var debug = function (message) {
if(should_log && (typeof console == "object")) console.log('activate_menu_item: ' + message);
Method create
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
if params[:quagmire].present?
flash[:failure] = "Comment rejected because you're behaving like a robot, please leave the 'Leave blank' field blank."
redirect_to(:back) rescue redirect_to proposals_path()
return
Method base_show
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def base_show
if selector? && @event.accept_selector_votes?
@selector_vote = @proposal.selector_votes.find_or_initialize_by(user_id: current_user.id)
end
Method create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
@proposal = @event.proposals.new(proposal_params)
@proposal.add_user(current_user) if logged_in?
@proposal.transition = transition_from_params if admin?
- 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 accept_and_reject_from_spreadsheet
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def accept_and_reject_from_spreadsheet
# Paste IDs from spreadsheet, separated by spaces
# ↓↓↓
reject = %w( ).map(&:to_i)
accept = %w( ).map(&:to_i)
- 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"