af83/chouette-core

View on GitHub
app/models/import/netex_generic.rb

Summary

Maintainability
D
3 days
Test Coverage

File netex_generic.rb has 1044 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Import::NetexGeneric < Import::Base
  include LocalImportSupport
  include Imports::WithoutReferentialSupport

  attr_accessor :imported_line_ids
Severity: Major
Found in app/models/import/netex_generic.rb - About 2 days to fix

    Method import! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def import!
          netex_source.routing_constraint_zones.each do |zone|
            decorator = Decorator.new(zone, line_provider: line_provider,
                                            stop_area_provider: stop_area_provider,
                                            code_space: code_space,
    Severity: Minor
    Found in app/models/import/netex_generic.rb - About 1 hr to fix

    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 import! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def import!
          netex_source.passenger_stop_assignments.each do |stop_assignment|
            scheduled_stop_point_id = stop_assignment.scheduled_stop_point_ref&.ref
            stop_area_code = (stop_assignment.quay_ref || stop_assignment.stop_place_ref)&.ref
    
    
    Severity: Minor
    Found in app/models/import/netex_generic.rb - About 55 mins to fix

    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 import! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def import!
          netex_source.service_journeys.each do |service_journey|
            decorator = Decorator.new(service_journey, day_types, index_route_journey_patterns, index_time_tables)
    
            unless decorator.valid?
    Severity: Minor
    Found in app/models/import/netex_generic.rb - About 45 mins to fix

    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 import! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def import!
          each_day_type_with_assignements_and_periods do |day_type, day_type_assignments, operating_periods|
    
            decorator = Decorator.new(day_type, day_type_assignments, operating_periods)
    
    
    Severity: Minor
    Found in app/models/import/netex_generic.rb - About 45 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status