af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

Similar blocks of code found in 19 locations. Consider refactoring.
Open

PasteButton.propTypes = {
  onClick: PropTypes.func.isRequired,
  disabled: PropTypes.bool.isRequired,
  selectionMode: PropTypes.bool.isRequired
}
app/packs/src/helpers/CustomFieldsInputs.js on lines 89..93
app/packs/src/journey_patterns/components/ConfirmModal.js on lines 44..48
app/packs/src/journey_patterns/components/SaveJourneyPattern.js on lines 20..24
app/packs/src/shape_editor/components/SaveButton.jsx on lines 44..48
app/packs/src/shape_editor/components/ShapeEditorMap.jsx on lines 99..103
app/packs/src/time_tables/components/ConfirmModal.js on lines 44..48
app/packs/src/time_tables/components/Navigate.js on lines 100..104
app/packs/src/time_tables/components/SaveTimetable.js on lines 38..42
app/packs/src/time_tables/components/TimeTableDay.js on lines 28..32
app/packs/src/vehicle_journeys/components/Tools.js on lines 82..86
app/packs/src/vehicle_journeys/components/tools/ConstraintExclusionEditVehicleJourney.js on lines 291..295
app/packs/src/vehicle_journeys/components/tools/CopyButton.js on lines 22..26
app/packs/src/vehicle_journeys/components/tools/DeleteVehicleJourneys.js on lines 25..29
app/packs/src/vehicle_journeys/components/tools/DuplicateVehicleJourney.js on lines 207..211
app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 220..224
app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js on lines 211..215
app/packs/src/vehicle_journeys/components/tools/SelectVehicleJourneys.js on lines 25..29
app/packs/src/vehicle_journeys/components/tools/ShiftVehicleJourney.js on lines 118..122

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 19 locations. Consider refactoring.
Open

Tools.propTypes = {
  vehicleJourneys : PropTypes.array.isRequired,
  onCancelSelection: PropTypes.func.isRequired,
  filters: PropTypes.object.isRequired
}
Severity: Major
Found in app/packs/src/vehicle_journeys/components/Tools.js and 18 other locations - About 50 mins to fix
app/packs/src/helpers/CustomFieldsInputs.js on lines 89..93
app/packs/src/journey_patterns/components/ConfirmModal.js on lines 44..48
app/packs/src/journey_patterns/components/SaveJourneyPattern.js on lines 20..24
app/packs/src/shape_editor/components/SaveButton.jsx on lines 44..48
app/packs/src/shape_editor/components/ShapeEditorMap.jsx on lines 99..103
app/packs/src/time_tables/components/ConfirmModal.js on lines 44..48
app/packs/src/time_tables/components/Navigate.js on lines 100..104
app/packs/src/time_tables/components/SaveTimetable.js on lines 38..42
app/packs/src/time_tables/components/TimeTableDay.js on lines 28..32
app/packs/src/vehicle_journeys/components/tools/ConstraintExclusionEditVehicleJourney.js on lines 291..295
app/packs/src/vehicle_journeys/components/tools/CopyButton.js on lines 22..26
app/packs/src/vehicle_journeys/components/tools/DeleteVehicleJourneys.js on lines 25..29
app/packs/src/vehicle_journeys/components/tools/DuplicateVehicleJourney.js on lines 207..211
app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 220..224
app/packs/src/vehicle_journeys/components/tools/PasteButton.js on lines 24..28
app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js on lines 211..215
app/packs/src/vehicle_journeys/components/tools/SelectVehicleJourneys.js on lines 25..29
app/packs/src/vehicle_journeys/components/tools/ShiftVehicleJourney.js on lines 118..122

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 19 locations. Consider refactoring.
Open

Navigate.propTypes = {
  status: PropTypes.object.isRequired,
  pagination: PropTypes.object.isRequired,
  dispatch: PropTypes.func.isRequired
}
Severity: Major
Found in app/packs/src/time_tables/components/Navigate.js and 18 other locations - About 50 mins to fix
app/packs/src/helpers/CustomFieldsInputs.js on lines 89..93
app/packs/src/journey_patterns/components/ConfirmModal.js on lines 44..48
app/packs/src/journey_patterns/components/SaveJourneyPattern.js on lines 20..24
app/packs/src/shape_editor/components/SaveButton.jsx on lines 44..48
app/packs/src/shape_editor/components/ShapeEditorMap.jsx on lines 99..103
app/packs/src/time_tables/components/ConfirmModal.js on lines 44..48
app/packs/src/time_tables/components/SaveTimetable.js on lines 38..42
app/packs/src/time_tables/components/TimeTableDay.js on lines 28..32
app/packs/src/vehicle_journeys/components/Tools.js on lines 82..86
app/packs/src/vehicle_journeys/components/tools/ConstraintExclusionEditVehicleJourney.js on lines 291..295
app/packs/src/vehicle_journeys/components/tools/CopyButton.js on lines 22..26
app/packs/src/vehicle_journeys/components/tools/DeleteVehicleJourneys.js on lines 25..29
app/packs/src/vehicle_journeys/components/tools/DuplicateVehicleJourney.js on lines 207..211
app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 220..224
app/packs/src/vehicle_journeys/components/tools/PasteButton.js on lines 24..28
app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js on lines 211..215
app/packs/src/vehicle_journeys/components/tools/SelectVehicleJourneys.js on lines 25..29
app/packs/src/vehicle_journeys/components/tools/ShiftVehicleJourney.js on lines 118..122

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 19 locations. Consider refactoring.
Open

SaveJourneyPattern.propTypes = {
  journeyPatterns: PropTypes.array.isRequired,
  status: PropTypes.object.isRequired,
  page: PropTypes.number.isRequired
}
app/packs/src/helpers/CustomFieldsInputs.js on lines 89..93
app/packs/src/journey_patterns/components/ConfirmModal.js on lines 44..48
app/packs/src/shape_editor/components/SaveButton.jsx on lines 44..48
app/packs/src/shape_editor/components/ShapeEditorMap.jsx on lines 99..103
app/packs/src/time_tables/components/ConfirmModal.js on lines 44..48
app/packs/src/time_tables/components/Navigate.js on lines 100..104
app/packs/src/time_tables/components/SaveTimetable.js on lines 38..42
app/packs/src/time_tables/components/TimeTableDay.js on lines 28..32
app/packs/src/vehicle_journeys/components/Tools.js on lines 82..86
app/packs/src/vehicle_journeys/components/tools/ConstraintExclusionEditVehicleJourney.js on lines 291..295
app/packs/src/vehicle_journeys/components/tools/CopyButton.js on lines 22..26
app/packs/src/vehicle_journeys/components/tools/DeleteVehicleJourneys.js on lines 25..29
app/packs/src/vehicle_journeys/components/tools/DuplicateVehicleJourney.js on lines 207..211
app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 220..224
app/packs/src/vehicle_journeys/components/tools/PasteButton.js on lines 24..28
app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js on lines 211..215
app/packs/src/vehicle_journeys/components/tools/SelectVehicleJourneys.js on lines 25..29
app/packs/src/vehicle_journeys/components/tools/ShiftVehicleJourney.js on lines 118..122

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

          model :workbench_processing_rule, association_name: :processing_rules do
            attribute(:operation_step) { 'after_import' }

            transient :control_list
            transient :macro_list
Severity: Minor
Found in app/lib/chouette/factory.rb and 1 other location - About 45 mins to fix
app/lib/chouette/factory.rb on lines 84..95

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 41.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        model :workgroup_processing_rule, association_name: :processing_rules do
          attribute(:operation_step) { 'after_import' }

          transient :control_list
          transient :macro_list
Severity: Minor
Found in app/lib/chouette/factory.rb and 1 other location - About 45 mins to fix
app/lib/chouette/factory.rb on lines 183..194

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 41.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    if(this.props.status.isFetching == true) {
      return false
    }
    if(this.props.status.fetchSuccess == true) {
Severity: Minor
Found in app/packs/src/vehicle_journeys/components/tools/CreateModal.js - 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

Avoid deeply nested control flow statements.
Open

                  if(element.stop_area_short_description.position === stop_point.position){
                    stop_point.checked = true
                  }
Severity: Major
Found in app/packs/src/journey_patterns/actions/index.js - About 45 mins to fix

    Function mapDispatchToProps has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const mapDispatchToProps = (dispatch) => {
      return {
        onOpenAddPeriodForm: () => {
          dispatch(actions.openAddPeriodForm())
        },
    Severity: Minor
    Found in app/packs/src/time_tables/containers/PeriodForm.js - 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

    Method optimize_overlapping_periods has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def optimize_overlapping_periods
          periods = self.clone_periods
          optimized = []
          i=0
          while i < periods.length
    Severity: Minor
    Found in app/models/chouette/time_table.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, 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 custom_fields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.custom_fields workgroup
          return CustomField.none unless workgroup
          @_custom_fields ||= {}
          unless @_custom_fields.has_key?(workgroup.id) && @_custom_fields[workgroup.id].first == workgroup.updated_at
            @_custom_fields[workgroup.id] = [workgroup.updated_at, _get_custom_fields(workgroup)]
    Severity: Minor
    Found in app/models/concerns/custom_fields_support.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 periods_max_date has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def periods_max_date
        return nil if self.periods.empty?
    
        min_start = self.periods.map(&:period_start).compact.min
        max_end = self.periods.map(&:period_end).compact.max
    Severity: Minor
    Found in app/models/concerns/timetable_support.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

    Function documentScroll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      documentScroll(e){
        if (this.sticky) {
          if ((e.pageY < this.top()) || (e.pageY > this.bottom())) {
            this.container.removeClass("sticky");
            return this.sticky = false;
    Severity: Minor
    Found in app/packs/src/referential_overview/index.js - 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 add_stop_point has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def add_stop_point(stop_time, position, starting_day_offset, stop_point, vehicle_journey, worker)
    Severity: Minor
    Found in app/models/import/gtfs.rb - About 45 mins to fix

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

            def checksum!
              ::Zip::File.open(file) do |zip_file|
                # Sort the entries by name to always digest in the same order
                zip_file.glob('*').sort_by(&:name).each do |entry|
                  # We could read only the beginning of larger files
      Severity: Minor
      Found in app/models/source.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 valid_referent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def valid_referent
            if referent_id.present? && referent?
              errors.add :referent_id, :a_referent_cannot_have_a_referent
            end
      
      
      Severity: Minor
      Found in app/models/concerns/referent_support.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def run
              geo_clusters.each do |geo_cluster|
                geo_cluster.compass_bearing_clusters.each do |cluster|
                  next unless cluster.count > 1
      
      
      Severity: Minor
      Found in app/models/macro/create_stop_area_referents.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 parse_calendars has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def parse_calendars calendars
                namespace = detect_namespace(calendars) || 'netex'
      
                xml = Nokogiri::XML(calendars)
      
      
      Severity: Minor
      Found in app/lib/stif/netex_file.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

      Severity
      Category
      Status
      Source
      Language