afimb/chouette2

View on GitHub

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
Severity: Minor
Found in app/exporters/chouette/hub/exporter.rb - About 1 day 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

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"

Severity: Major
Found in app/models/chouette/time_table.rb - About 7 hrs to fix

    Class VehicleJourneyExport has 40 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class VehicleJourneyExport   
      include ActiveModel::Validations
      include ActiveModel::Conversion
      extend  ActiveModel::Naming
    
    
    Severity: Minor
    Found in app/models/vehicle_journey_export.rb - About 5 hrs to fix

      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
      Severity: Minor
      Found in app/models/chouette/stop_area.rb - About 5 hrs to fix

        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))
        Severity: Minor
        Found in app/models/clean_up.rb - About 5 hrs 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 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,
        Severity: Major
        Found in app/models/rule_parameter_set.rb - About 5 hrs to fix

          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"
          
          
          Severity: Minor
          Found in app/models/chouette/time_table.rb - About 4 hrs to fix

            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)
            Severity: Minor
            Found in app/helpers/history_helper.rb - About 4 hrs 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 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
            Severity: Major
            Found in app/exporters/chouette/hub/exporter.rb - About 4 hrs to fix

              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?
              Severity: Minor
              Found in app/models/chouette/time_table.rb - About 4 hrs 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 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) )
              Severity: Major
              Found in app/maps/stop_area_map.rb - About 4 hrs to fix

                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
                Severity: Minor
                Found in app/models/referential.rb - About 3 hrs to fix

                  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
                  Severity: Minor
                  Found in app/models/rule_parameter_set.rb - About 3 hrs to fix

                    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
                    Severity: Minor
                    Found in app/exporters/chouette/kml/exporter.rb - About 3 hrs 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

                    Class Client has 28 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class Client
                    
                        include Ievkitdeprecated::Configurable
                        include Ievkitdeprecated::Authentication
                        include Ievkitdeprecated::Client::Jobs
                    Severity: Minor
                    Found in lib/ievkitdeprecated/client.rb - About 3 hrs to fix

                      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))
                      Severity: Major
                      Found in app/models/clean_up.rb - About 3 hrs to fix

                        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 = []
                        Severity: Minor
                        Found in app/models/vehicle_journey_import.rb - About 3 hrs 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 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
                        
                        
                        Severity: Minor
                        Found in lib/osrm_5_route_section_processor.rb - About 3 hrs 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 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
                        
                        
                        Severity: Major
                        Found in app/maps/route_section_selector_map.rb - About 2 hrs to fix

                          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
                          Severity: Minor
                          Found in app/models/rule_parameter_set.rb - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language