Showing 117 of 269 total issues
Method processAuthentification
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def processAuthentification
@user = User.from_omniauth(request.env["omniauth.auth"])
if @user.new_record?
session['user_stand_by_provider'] = @user.provider
session['user_stand_by_uid'] = @user.uid
- 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 valid_days
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.valid_days(int_day_types)
# Build an array with day of calendar week (1-7, Monday is 1).
[].tap do |valid_days|
valid_days << 1 if day_by_mask(int_day_types,4)
valid_days << 2 if day_by_mask(int_day_types,8)
- 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 decode_hash_value
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def decode_hash_value(key, value)
if time_field?(key, value)
if value.is_a?(String)
begin
Time.parse(value)
- 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 valid?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def valid?
unless organisation.valid?
self.errors.add( :organisation_name, organisation.errors[:name]) if organisation.errors[:name]
end
unless user.valid?
- 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 initialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize(vehicle_journey, directory, index)
@vehicle_journey = vehicle_journey
@number = index
@directory = directory
@template = File.open('app/views/api/hub/courses_operations.hub.erb' ) { |f| f.read }
- 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 initialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize(attributes = {})
attributes.each { |name, value| send("#{name}=", value) } if attributes
if self.area_type.blank? && self.source != nil
self.source_id = self.source.id
if self.hierarchy == "child"
- 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 save
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def save
begin
if self.valid?
Chouette::StopArea.transaction do
copy.update_attributes copy_modfied_attributes
- 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 search
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search
if options[:json]
tokenLimit = options[:tokenLimit].present? ? options[:tokenLimit] : "null"
template.content_tag( :script,
("$(document).ready(function() {
Method paginate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def paginate(url, options = {}, &block)
opts = parse_query_and_convenience_headers(options.dup)
if @auto_paginate || @per_page
opts[:query][:per_page] ||= @per_page || (@auto_paginate ? 100 : nil)
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 available_imports
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def available_imports
import_task_parameters = params[:import_task]
if import_task_parameters.present?
@available_imports = [
- 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 select_lines
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def select_lines(object, ids)
if object == "network"
ids.present? ? Chouette::Line.includes(:routes).where( :network_id => ids.split(",")).order(:name) :
Chouette::Line.joins(:network).includes(:routes).order(:name)
elsif object == "company"
- 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 vehicle_title
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def vehicle_title(vehicle, journey_frequency=nil)
return t("vehicle_journeys.vehicle_journey#{'_frequency' if vehicle.frequency?}.title_stopless", :name => vehicle_name( vehicle)) if vehicle.vehicle_journey_at_stops.empty?
first_vjas = vehicle.vehicle_journey_at_stops.first
if vehicle.frequency? && journey_frequency
t("vehicle_journeys.vehicle_journey_frequency.title_frequency",
- 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 special_vehicle_journey_icon
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def special_vehicle_journey_icon(field, vehicle_journey)
fa_class = { mobility_restricted_suitability: 'fa-wheelchair', flexible_service: 'fa-phone' }.map{ |k, v| v if k == field }.compact
if vehicle_journey.send(field).to_s.present?
fa_class << 'fa-line-through' unless vehicle_journey.send(field)
- 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 select_lines
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def select_lines(object, ids)
if object == "network"
ids.present? ? Chouette::Line.includes(:routes).where(:network_id => ids.split(",")).order(:objectid) :
Chouette::Line.joins(:network).includes(:routes).order(:objectid)
elsif object == "company"
- 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 hover_control_display_name
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hover_control_display_name(layer)
OpenLayers::Control::SelectFeature.new( layer, {
:autoActivate => true,
:hover => true,
:renderIntent => "temporary",
Method load
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load
self.content = File.read(filename)
self.data ||= {}
if self.content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
Method default_style
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def default_style
{
:fontColor => "black",
:fontSize => "11px",
Method customize_map
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def customize_map(map, page)
# layers order seems to matter for ModifyFeature control
route_section.stop_areas.each do |stop_area|
layer = "stop_area_#{stop_area.id}".to_sym
page.assign layer.to_s, kml_layer(stop_area, :styleMap => Design::StopAreasStyleMap.new(helpers).style_map)
Method detail_access_link_matrix
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def detail_access_link_matrix
matrix = Array.new
hash = Hash.new
access_links.each do |link|
hash[link.link_key] = link
Method validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate(record)
timeband = record.timeband
if timeband
first_departure_time = record.first_departure_time.utc.strftime( "%H%M%S%N" )
last_departure_time = record.last_departure_time.utc.strftime( "%H%M%S%N" )
- 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"