af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

  def merge!
    logger.tagged("Merge ##{merge.id}") do
      referential.switch do
        Chouette::ChecksumUpdater.new(referential).update
      end
Severity: Minor
Found in app/models/merge/referential/legacy.rb - About 5 days 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

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

class Export::NetexGeneric < Export::Base
  include LocalExportSupport

  option :profile, enumerize: %w[none french european idfm/line idfm/full], default: :none
  option :duration
Severity: Major
Found in app/models/export/netex_generic.rb - About 3 days to fix

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

                            <div className='row'>
                              <div className='col-lg-12'>
                                <div className='subform'>
                                  <div className='nested-head'>
                                    <div className='wrapper'>
    app/packs/src/vehicle_journeys/components/tools/ConstraintExclusionEditVehicleJourney.js on lines 198..254

    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 571.

    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

                            { this.props.stopAreasConstraints && <div className='row'>
                              <div className='col-lg-12'>
                                <div className='subform'>
                                  <div className='nested-head'>
                                    <div className='wrapper'>
    app/packs/src/vehicle_journeys/components/tools/ConstraintExclusionEditVehicleJourney.js on lines 140..196

    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 571.

    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

    File gtfs.rb has 1267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Export::Gtfs < Export::Base
      include LocalExportSupport
    
      option :period, default_value: 'all_periods', enumerize: %w[all_periods only_next_days static_day_period]
      option :duration
    Severity: Major
    Found in app/models/export/gtfs.rb - About 3 days to fix

      File gtfs.rb has 1154 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class Import::Gtfs < Import::Base # rubocop:disable Metrics/ClassLength
        include LocalImportSupport
      
        after_commit :update_main_resource_status, on:  [:create, :update]
      
      
      Severity: Major
      Found in app/models/import/gtfs.rb - About 2 days to fix

        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

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

                              <div>
                                <div className={'form-group date ' + (modal.modalProps.error ? ' has-error' : '')}>
                                  <div className="form-inline">
                                    <select value={formatNumber(modal.modalProps.begin.day)} onChange={(e) => onUpdatePeriodForm(e, 'begin', 'day', modal.modalProps)} id="q_validity_period_begin_gteq_3i" className="date required form-control">
                                      {makeDaysOptions(modal.modalProps.begin.day)}
          Severity: Major
          Found in app/packs/src/time_tables/components/PeriodForm.js and 1 other location - About 1 day to fix
          app/packs/src/time_tables/components/PeriodForm.js on lines 86..100

          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 341.

          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

                              <div>
                                <div className={'form-group date ' + (modal.modalProps.error ? ' has-error' : '')}>
                                  <div className="form-inline">
                                    <select value={formatNumber(modal.modalProps.end.day)} onChange={(e) => onUpdatePeriodForm(e, 'end', 'day', modal.modalProps)} id="q_validity_period_end_gteq_3i" className="date required form-control">
                                      {makeDaysOptions(modal.modalProps.end.day)}
          Severity: Major
          Found in app/packs/src/time_tables/components/PeriodForm.js and 1 other location - About 1 day to fix
          app/packs/src/time_tables/components/PeriodForm.js on lines 71..85

          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 341.

          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

          actions has 94 functions (exceeds 20 allowed). Consider refactoring.
          Open

          const actions = {
            enterEditMode: () => ({
              type: "ENTER_EDIT_MODE"
            }),
            exitEditMode: () => ({
          Severity: Major
          Found in app/packs/src/vehicle_journeys/actions/index.js - About 1 day to fix

            Class Referential has 93 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Referential < ApplicationModel
              prepend ReferentialSaveWithLock
            
              include DataFormatEnumerations
              include ObjectidFormatterSupport
            Severity: Major
            Found in app/models/referential.rb - About 1 day to fix

              Method table_builder has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
              Open

                def table_builder collection, columns, actions, selectable = [], cls = nil
                  return unless collection.present?
              
                  head = content_tag :thead do
                    content_tag :tr do
              Severity: Minor
              Found in app/helpers/newapplication_helper.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

              File referential.rb has 648 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module ReferentialSaveWithLock
                def save(options = {})
                  super(options)
                rescue ActiveRecord::StatementInvalid => e
                  Chouette::Safe.capture "Referential #{name} with slug #{slug} save failed", e
              Severity: Major
              Found in app/models/referential.rb - About 1 day to fix

                Method merge! has 282 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def merge!
                    logger.tagged("Merge ##{merge.id}") do
                      referential.switch do
                        Chouette::ChecksumUpdater.new(referential).update
                      end
                Severity: Major
                Found in app/models/merge/referential/legacy.rb - About 1 day to fix

                  Class StopArea has 75 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class StopArea < Chouette::ActiveRecord
                      include StopAreaReferentialSupport
                  
                      has_metadata
                      include ProjectionFields
                  Severity: Major
                  Found in app/models/chouette/stop_area.rb - About 1 day to fix

                    Function modal has 279 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function modal(state = {}, action) {
                      switch (action.type) {
                        case 'OPEN_CONFIRM_MODAL':
                          $('#ConfirmModal').modal('show')
                          return _.assign({}, state, {
                    Severity: Major
                    Found in app/packs/src/vehicle_journeys/reducers/modal.js - About 1 day to fix

                      Method links_builder has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def links_builder(item, actions)
                          trigger = content_tag :div, class: 'btn dropdown-toggle', data: { toggle: 'dropdown' } do
                            content_tag :span, '', class: 'fa fa-cog'
                          end
                      
                      
                      Severity: Minor
                      Found in app/helpers/newapplication_helper.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

                      File index.js has 606 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { batchActions } from '../batch'
                      
                      const actions = {
                        enterEditMode: () => ({
                          type: "ENTER_EDIT_MODE"
                      Severity: Major
                      Found in app/packs/src/vehicle_journeys/actions/index.js - About 1 day to fix

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

                                        <div className='form-group time filter_menu-item'>
                                          <label className='control-label time'>{I18n.t("vehicle_journeys.form.departure_range.end")}</label>
                                          <div className='form-inline'>
                                            <div className='input-group time'>
                                              <input
                        Severity: Major
                        Found in app/packs/src/vehicle_journeys/components/Filters.js and 1 other location - About 1 day to fix
                        app/packs/src/vehicle_journeys/components/Filters.js on lines 79..102

                        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 238.

                        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

                                        <div className='form-group time filter_menu-item'>
                                          <label className='control-label time'>{I18n.t("vehicle_journeys.form.departure_range.start")}</label>
                                          <div className='form-inline'>
                                            <div className='input-group time'>
                                              <input
                        Severity: Major
                        Found in app/packs/src/vehicle_journeys/components/Filters.js and 1 other location - About 1 day to fix
                        app/packs/src/vehicle_journeys/components/Filters.js on lines 103..126

                        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 238.

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language