Showing 117 of 269 total issues
Method period_validation
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def period_validation
st_date = start_date.present? && start_date.is_a?(String) ? Date.parse(start_date) : start_date
ed_date = end_date.present? && end_date.is_a?(String) ? Date.parse(end_date) : end_date
unless Chouette::TimeTable.start_validity_period.nil? || st_date.nil?
- 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 recalculate_day_offset
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def recalculate_day_offset
return unless recalculate_offset
vjass = self.vehicle_journey_at_stops
return unless vjass.present?
- 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
Class Route
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Chouette::Route < Chouette::TridentActiveRecord
include RouteRestrictions
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
Method load_imported_vehicle_journeys
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_imported_vehicle_journeys
spreadsheet = open_spreadsheet(file)
vehicle_journeys = []
Method initialize
has 61 lines of code (exceeds 25 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 }
Method customize_map
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def customize_map(map, page)
if stop_area.parents.present?
page.assign "parents_layer", kml_layer(stop_area, { :parents => true }, :style_map => Design::StopAreasStyleMap.new(helpers).style_map)
page << map.add_layer(:parents_layer)
page << map.add_control( hover_control_display_name(:parents_layer) )
- 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 object_labels_hash
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def object_labels_hash (error)
### THE error HASH STRUCTURE
# 1. error[:source]
# 0..1 file
# 1 filename
- 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_breadcrumb
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_breadcrumb(action)
action = action.to_sym
case resource_class.to_s
when "Chouette::Network"
network_breadcrumb action
Method initialize
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def initialize(vehicle_journey, directory, index)
@vehicle_journey = vehicle_journey
@directory = directory
@template = File.open('app/views/api/hub/courses.hub.erb' ) { |f| f.read }
@numero = index
- 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_exports
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def available_exports
export_task_parameters = params[:export_task]
if export_task_parameters.present?
@available_exports = [
export_task_parameters[:data_format] == "neptune" ? build_resource : NeptuneExport.new(:referential_id => @referential.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
File stop_area.rb
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'geokit'
require 'geo_ruby'
class Chouette::StopArea < Chouette::TridentActiveRecord
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
Class ApplicationMap
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationMap
include MapLayers
include MapLayers::ViewHelpers
Method execute_geometry
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def execute_geometry(secondary = false)
if secondary && Rails.application.secrets.osrm_secondary_endpoint.present?
@osrm_endpoint = Rails.application.secrets.osrm_secondary_endpoint
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 export
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def export(zip_file_path, options = {})
begin
referential.switch
FileUtils.rm(zip_file_path) if File.exists? zip_file_path
Method help_path
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def help_path
path = request.env['PATH_INFO']
target = case
when path.include?("/help")
""
Method merge!
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def merge!(another_tt)
transaction do
# if one tt has no period, just merge lists
if self.periods.empty? || another_tt.periods.empty?
if !another_tt.periods.empty?
Method initialize
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(vehicle_journey, directory, index)
@vehicle_journey = vehicle_journey
@directory = directory
@template = File.open('app/views/api/hub/courses.hub.erb' ) { |f| f.read }
@numero = index
Method search
has 46 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 tt_day_types
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def tt_day_types(tt)
type = tt.monday ? label("monday") : ".."
type += tt.tuesday ? label("tuesday") : ".."
type += tt.wednesday ? label("wednesday") : ".."
type += tt.thursday ? label("thursday") : ".."
- 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 valid_days
# Build an array with day of calendar week (1-7, Monday is 1).
[].tap do |valid_days|
valid_days << 1 if monday
valid_days << 2 if tuesday
- 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"