Showing 117 of 269 total issues
Method export
has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring. Open
def export(zip_file_path, options = {})
begin
referential.switch
if referential_exportable? && options[:start_date] && options[:end_date]
FileUtils.rm(zip_file_path) if File.exists? zip_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
Class TimeTable
has 51 methods (exceeds 20 allowed). Consider refactoring. Open
class Chouette::TimeTable < Chouette::TridentActiveRecord
include TimeTableRestrictions
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
Class StopArea
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Chouette::StopArea < Chouette::TridentActiveRecord
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
include Geokit::Mappable
include ProjectionFields
Class VehicleJourneyExport
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class VehicleJourneyExport
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
Method clean
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def clean
# as foreign keys are presents , delete method can be used for faster performance
result = CleanUpResult.new
# find and remove time_tables
tms = Chouette::TimeTable.validity_out_from_on?(Date.parse(expected_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 mode_default_params
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.mode_default_params
{
:coach => {
:allowed_transport_mode_coach => false,
:inter_stop_area_distance_min_mode_coach => 500,
File time_table.rb
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Chouette::TimeTable < Chouette::TridentActiveRecord
include TimeTableRestrictions
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
Method creation_tag
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def creation_tag(object)
field_set_tag t("layouts.history_tag.title"), :class => "history_tag" do
content_tag :ul do
[(content_tag :li do
if object.has_attribute?(:creation_time)
- 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 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
def export(zip_file_path, options = {})
begin
referential.switch
if referential_exportable? && options[:start_date] && options[:end_date]
FileUtils.rm(zip_file_path) if File.exists? zip_file_path
Method merge!
has a Cognitive Complexity of 29 (exceeds 5 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?
- 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 customize_map
has 103 lines of code (exceeds 25 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) )
Class Referential
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Referential < ActiveRecord::Base
include DataFormatEnumerations
validates_presence_of :name
validates_presence_of :prefix
File rule_parameter_set.rb
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
class RuleParameterSet < ActiveRecord::Base
belongs_to :organisation
#validates_presence_of :referential
validates_presence_of :name
Method export
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def export(zip_file_path, options = {})
begin
referential.switch
FileUtils.rm(zip_file_path) if File.exists? zip_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
Class Client
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Client
include Ievkitdeprecated::Configurable
include Ievkitdeprecated::Authentication
include Ievkitdeprecated::Client::Jobs
Method clean
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
def clean
# as foreign keys are presents , delete method can be used for faster performance
result = CleanUpResult.new
# find and remove time_tables
tms = Chouette::TimeTable.validity_out_from_on?(Date.parse(expected_date))
Method load_imported_vehicle_journeys
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def load_imported_vehicle_journeys
spreadsheet = open_spreadsheet(file)
vehicle_journeys = []
- 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 execute_geometry
has a Cognitive Complexity of 23 (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 customize_map
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
def customize_map(map, page)
layer = kml_layer([route_section_selector.itinerary.referential, route_section_selector.itinerary.route.line, route_section_selector.itinerary.route, route_section_selector.itinerary],
{ rendererOptions: { zIndexing: true }, styleMap: Design::JourneyPatternStyleMap.new(helpers).style_map })
page.assign 'journeyPatternLayer', layer
Class RuleParameterSet
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class RuleParameterSet < ActiveRecord::Base
belongs_to :organisation
#validates_presence_of :referential
validates_presence_of :name