af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

Method copy_route has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def copy_route route
    line = route.line
    attributes = clean_attributes_for_copy route
    opposite_route = route.opposite_route

Severity: Minor
Found in app/services/referential_copy.rb - About 1 hr to fix

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

              shape: this.props.journeyPattern.shape ? {id: this.props.journeyPattern.shape.id, name: this.props.journeyPattern.shape.name, uuid: this.props.journeyPattern.shape.uuid } : undefined
    Severity: Major
    Found in app/packs/src/journey_patterns/components/EditModal.js and 1 other location - About 1 hr to fix
    app/packs/src/journey_patterns/components/CreateModal.js on lines 19..19

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

    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

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

            shape: this.props?.journeyPattern?.shape ? { id: this.props.journeyPattern.shape.id, name: this.props.journeyPattern.shape.name, uuid: this.props.journeyPattern.shape.uuid } : undefined
    Severity: Major
    Found in app/packs/src/journey_patterns/components/CreateModal.js and 1 other location - About 1 hr to fix
    app/packs/src/journey_patterns/components/EditModal.js on lines 20..20

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

    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 mapDispatchToProps has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const mapDispatchToProps = (dispatch) => {
      return {
        onLoadFirstPage: (filters, routeUrl) =>{
          dispatch(actions.fetchingApi())
          actions.fetchVehicleJourneys(dispatch, undefined, undefined, filters.queryString, routeUrl)
    Severity: Minor
    Found in app/packs/src/vehicle_journeys/containers/VehicleJourneysList.js - About 1 hr to fix

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

              $(this).find('.t2e-head').children('div').each(function() {
                var h = this.getBoundingClientRect().height;
                refH.push(h)
              });
      app/packs/src/journey_patterns/components/JourneyPatterns.js on lines 27..30
      app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js on lines 43..46

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

      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

                    {mode == 'copy' && <button
                      className='btn btn-default'
                      onClick={toPasteMode}>
                        <i className='fa fa-paste'></i>
                        <span>{ I18n.t('courses_copy_paste.modal.to_paste_mode') }</span>
      Severity: Major
      Found in app/packs/src/vehicle_journeys/components/CopyModal.js and 1 other location - About 1 hr to fix
      app/packs/src/vehicle_journeys/components/CopyModal.js on lines 123..128

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

              $(this).find('.t2e-head').children('div').each(function() {
                var h = this.getBoundingClientRect().height
                refH.push(h)
              })
      app/packs/src/journey_patterns/components/JourneyPatterns.js on lines 27..30
      app/packs/src/vehicle_journeys/components/VehicleJourneysList.js on lines 122..125

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

              $(this).find('.t2e-head').children('div').each(function() {
                var h = this.getBoundingClientRect().height;
                refH.push(h)
              });
      app/packs/src/vehicle_journeys/components/VehicleJourneysList.js on lines 122..125
      app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js on lines 43..46

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

      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

                    {mode == 'paste' && !pasteOnly && <button
                      className='btn btn-default'
                        onClick={toCopyMode}>
                        <i className='fa fa-caret-left'></i>
                        <span>{ I18n.t('courses_copy_paste.modal.to_copy_mode') }</span>
      Severity: Major
      Found in app/packs/src/vehicle_journeys/components/CopyModal.js and 1 other location - About 1 hr to fix
      app/packs/src/vehicle_journeys/components/CopyModal.js on lines 117..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 65.

      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 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          let { hasPolicy, hasFeature, hasDeletedVJ, props: { vehicleJourneys, onCancelSelection, onCancelDeletion, editMode, selectionMode, selection, toggleArrivals } } = this
          return (
            <div className='select_toolbox'>
              <ul>
      Severity: Minor
      Found in app/packs/src/vehicle_journeys/components/Tools.js - About 1 hr to fix

        Function renderShapeEditorButtons has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const renderShapeEditorButtons = () => {
            const { id } = journeyPattern
        
            if (!hasFeature('shape_editor_experimental') || !editMode || !id) return []
        
        
        Severity: Minor
        Found in app/packs/src/journey_patterns/components/JourneyPattern.js - About 1 hr to fix

          Function addAjaxSelectToForm has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function addAjaxSelectToForm(dom_part) {
            dom_part.querySelectorAll('select.ajax_select').forEach((el) => {
              let plugin_list = []
              if (el.hasAttribute("multiple")) {
                plugin_list = ['clear_button', 'remove_button']
          Severity: Minor
          Found in app/packs/entrypoints/inputs/ajax_select.js - About 1 hr to fix

            Method prepare_new has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def prepare_new
                if Rails.env.test? && new.present?
                  Rails.logger.debug 'Use existing new for test'
                  return
                end
            Severity: Minor
            Found in app/models/merge.rb - About 1 hr to fix

              Method compute_bearings has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def compute_bearings(options={})
                      query = <<~TEXT
                        SELECT
                          stop_area_id, AVG(bearing) AS avg_bearing
                        FROM (
              Severity: Minor
              Found in app/models/chouette/stop_area.rb - About 1 hr to fix

                Method load_missions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def load_missions
                    @all_missions = route.journey_patterns.count > 10 ? [] : route.journey_patterns.map do |item|
                      published_name = ERB::Util.h(item.published_name)
                      short_id = ERB::Util.h(item.get_objectid.short_id)
                      registration_number = ERB::Util.h(item.registration_number)
                Severity: Minor
                Found in app/controllers/route_vehicle_journeys_controller.rb - About 1 hr to fix

                  Method path has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def path
                        if model_class == Chouette::Line
                          workbench_line_referential_line_path(workbench, model_id)
                        elsif model_class == Chouette::Company
                          workbench_line_referential_company_path(workbench, model_id)
                  Severity: Minor
                  Found in app/lib/chouette/model_path_finder.rb - About 1 hr to fix

                    Method commit has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def commit
                          begin
                            return if resolution_stack.empty?
                    
                            Apartment::Tenant.switch @current_tenant do
                    Severity: Minor
                    Found in app/lib/chouette/checksum_manager/transactional.rb - About 1 hr to fix

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

                      ConfirmModal.propTypes = {
                        vehicleJourneys: PropTypes.array.isRequired,
                        modal: PropTypes.object.isRequired,
                        onModalAccept: PropTypes.func.isRequired,
                        onModalCancel: PropTypes.func.isRequired
                      Severity: Major
                      Found in app/packs/src/vehicle_journeys/components/ConfirmModal.js and 4 other locations - About 1 hr to fix
                      app/packs/src/journey_patterns/components/Navigate.js on lines 59..64
                      app/packs/src/time_tables/components/PeriodManager.js on lines 77..82
                      app/packs/src/time_tables/components/PeriodsInDay.js on lines 71..76
                      app/packs/src/vehicle_journeys/components/Navigate.js on lines 51..56

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

                      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 5 locations. Consider refactoring.
                      Open

                      PeriodManager.propTypes = {
                        value: PropTypes.object.isRequired,
                        currentDate: PropTypes.object.isRequired,
                        onDeletePeriod: PropTypes.func.isRequired,
                        onOpenEditPeriodForm: PropTypes.func.isRequired
                      Severity: Major
                      Found in app/packs/src/time_tables/components/PeriodManager.js and 4 other locations - About 1 hr to fix
                      app/packs/src/journey_patterns/components/Navigate.js on lines 59..64
                      app/packs/src/time_tables/components/PeriodsInDay.js on lines 71..76
                      app/packs/src/vehicle_journeys/components/ConfirmModal.js on lines 36..41
                      app/packs/src/vehicle_journeys/components/Navigate.js on lines 51..56

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

                      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 5 locations. Consider refactoring.
                      Open

                      Navigate.propTypes = {
                        vehicleJourneys: PropTypes.array.isRequired,
                        status: PropTypes.object.isRequired,
                        pagination: PropTypes.object.isRequired,
                        dispatch: PropTypes.func.isRequired
                      Severity: Major
                      Found in app/packs/src/vehicle_journeys/components/Navigate.js and 4 other locations - About 1 hr to fix
                      app/packs/src/journey_patterns/components/Navigate.js on lines 59..64
                      app/packs/src/time_tables/components/PeriodManager.js on lines 77..82
                      app/packs/src/time_tables/components/PeriodsInDay.js on lines 71..76
                      app/packs/src/vehicle_journeys/components/ConfirmModal.js on lines 36..41

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

                      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