af83/chouette-core

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

Summary

Maintainability
F
3 days
Test Coverage

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

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

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

    Class Decorator has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class Decorator < SimpleDelegator
            def initialize(route, journey_patterns, scheduled_stop_points: nil, route_points: nil, directions: nil,
                           destination_displays: nil, line_provider: nil, code_builder: nil)
              super route
    
    
    Severity: Minor
    Found in app/models/import/netex_generic.rb - About 2 hrs 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 31 lines of code (exceeds 25 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,
                                          code_builder: code_builder)
      
      
      Severity: Minor
      Found in app/models/import/netex_generic.rb - About 1 hr to fix

        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!
                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, code_builder: code_builder)
        
                  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!
                netex_source.service_journeys.each do |service_journey|
                  decorator = Decorator.new(service_journey, day_types, index_route_journey_patterns, index_time_tables,
                                            code_builder: code_builder)
        
        
        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