af83/chouette-core

View on GitHub
app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js

Summary

Maintainability
F
3 days
Test Coverage

Function render has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    let journey_pattern_id = _.get(this.props.modal.modalProps, 'vehicleJourney.journey_pattern.id')
    this.fetch_available_specific_stop_places(journey_pattern_id)

    let id =  _.get(this.props.modal.modalProps, 'vehicleJourney.short_id')
Severity: Major
Found in app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js - About 3 hrs to fix

    Function componentDidUpdate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      componentDidUpdate(prevProps, prevState) {
        if(this.props.status.isFetching == false){
          // Don't forget the .modal pre selector to avoid modifying the DOM outside our modal
          $('.modal .table-2entries').each(function() {
            var refH = []

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

              $(this).find('.t2e-item').children('div').each(function() {
                var h = this.getBoundingClientRect().height
                if(refCol.length < refH.length){
                  refCol.push(h)
                } else {
      app/packs/src/journey_patterns/components/JourneyPatterns.js on lines 33..47
      app/packs/src/vehicle_journeys/components/VehicleJourneysList.js on lines 128..142

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

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

              <button
                type='button'
                disabled={(actions.getSelected(this.props.vehicleJourneys).length != 1 || this.props.disabled)}
                data-toggle='modal'
                data-target='#SelectSpecificStopModal'
      app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 47..56
      app/packs/src/vehicle_journeys/components/tools/NotesEditVehicleJourney.js on lines 123..132

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

      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.editMode &&
                              <div className='modal-footer'>
                                <button
                                  className='btn btn-cancel'
      app/packs/src/vehicle_journeys/components/tools/NotesEditVehicleJourney.js on lines 149..168

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

      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='modal-header'>
                          <h4 className='modal-title'>{I18n.t('vehicle_journeys.form.specific_stops_title', {id: id})}</h4>
                          <span type="button" className="close modal-close" data-dismiss="modal">&times;</span>
                        </div>
      app/packs/src/vehicle_journeys/components/tools/ShiftVehicleJourney.js on lines 59..62

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

      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

              for(var n = 0; n < refH.length; n++) {
                if(refCol[n] < refH[n]) {
                  refCol[n] = refH[n]
                }
              }
      app/packs/src/journey_patterns/components/JourneyPatterns.js on lines 49..53
      app/packs/src/vehicle_journeys/components/VehicleJourneysList.js on lines 144..148

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

      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

            SelectSpecificStop.propTypes = {
              onOpenSelectSpecificStopModal: PropTypes.func.isRequired,
              onModalClose: PropTypes.func.isRequired,
              disabled: 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/PasteButton.js on lines 24..28
      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

      There are no issues that match your filters.

      Category
      Status