af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

                        <div className='form-group'>
                          <label className='control-label is-required col-sm-8'>{I18n.t('vehicle_journeys.vehicle_journeys_matrix.duplicate.delta')}</label>
                          <span className="col-sm-4">
                            <input
                              type='number'
app/packs/src/vehicle_journeys/components/tools/DuplicateVehicleJourney.js on lines 136..153

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

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'>
                          <label className='control-label is-required col-sm-8'>{I18n.t('vehicle_journeys.vehicle_journeys_matrix.duplicate.number')}</label>
                          <div className="col-sm-4">
                            <input
                              type='number'
app/packs/src/vehicle_journeys/components/tools/DuplicateVehicleJourney.js on lines 155..172

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

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

  render() {
    if(this.props.status.isFetching == true) {
      return false
    }
    if(this.props.status.fetchSuccess == true) {
Severity: Major
Found in app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js - About 6 hrs to fix

    Function vehicleJourneys has 161 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function vehicleJourneys(state = [], action) {
      switch (action.type) {
        case 'RECEIVE_VEHICLE_JOURNEYS':
          return [...action.json]
        case 'RECEIVE_ERRORS':
    Severity: Major
    Found in app/packs/src/vehicle_journeys/reducers/vehicleJourneys.js - About 6 hrs to fix

      File neptune.rb has 427 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class Import::Neptune < Import::Base
        include LocalImportSupport
      
        def self.accepts_file?(file)
          ::Neptune::Source.accept?(file)
      Severity: Minor
      Found in app/models/import/neptune.rb - About 6 hrs to fix

        File service_facility.rb has 421 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Chouette
          class ServiceFacility
            attr_reader :category, :sub_category
        
            def initialize(category, sub_category=nil)
        Severity: Minor
        Found in app/lib/chouette/service_facility.rb - About 6 hrs to fix

          Function JourneyPattern has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function JourneyPattern({
            editMode,
            enterEditMode,
            fetchingApi,
            fetchRouteCosts,
          Severity: Minor
          Found in app/packs/src/journey_patterns/components/JourneyPattern.js - About 6 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

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

              case 'SELECT_CONSTRAINT_ZONE_MODAL':
                selectedConstraintZones = state.modalProps.selectedConstraintZones
                alreadyPresent = false
                selectedConstraintZones.map((zone_id, i)=>{
                  if(zone_id == parseInt(action.selectedZone.id)){
          Severity: Major
          Found in app/packs/src/vehicle_journeys/reducers/modal.js and 1 other location - About 6 hrs to fix
          app/packs/src/vehicle_journeys/reducers/modal.js on lines 191..202

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

          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

              case 'SELECT_STOPAREAS_CONSTRAINT_MODAL':
                selectedStopAreasConstraints = state.modalProps.selectedStopAreasConstraints
                alreadyPresent = false
                selectedStopAreasConstraints.map((zone_id, i)=>{
                  if(zone_id == parseInt(action.selectedZone.id)){
          Severity: Major
          Found in app/packs/src/vehicle_journeys/reducers/modal.js and 1 other location - About 6 hrs to fix
          app/packs/src/vehicle_journeys/reducers/modal.js on lines 169..180

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

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

          export default function selection(state = initialState, action) {
              const { selection, filters: { toggleArrivals } } = state
              const { copyModal } = selection
          
              switch(action.type) {
          Severity: Major
          Found in app/packs/src/vehicle_journeys/reducers/selection.js - About 5 hrs to fix

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

                                        <input
                                            type='number'
                                            className='form-control'
                                            disabled={!isEditable || isDisabled || !hasUpdatePermission}
                                            readOnly={!isEditable && !vjas.dummy}
            app/packs/src/vehicle_journeys/components/VehicleJourneyAtStop.js on lines 126..135

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

            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

                                            <input
                                                type='number'
                                                className='form-control'
                                                disabled={!isEditable || isDisabled || !hasUpdatePermission}
                                                readOnly={!isEditable && !vjas.dummy}
            app/packs/src/vehicle_journeys/components/VehicleJourneyAtStop.js on lines 110..119

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

            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

                                            <input
                                                type='number'
                                                className='form-control'
                                                disabled={!isEditable || isDisabled || !hasUpdatePermission}
                                                readOnly={!isEditable && !vjas.dummy}
            app/packs/src/vehicle_journeys/components/VehicleJourneyAtStop.js on lines 99..108

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

            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

                                        <input
                                            type='number'
                                            className='form-control'
                                            disabled={!isEditable || isDisabled || !hasUpdatePermission}
                                            readOnly={!isEditable && !vjas.dummy}
            app/packs/src/vehicle_journeys/components/VehicleJourneyAtStop.js on lines 137..146

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

            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-footer'>
                        <button
                          className='btn btn-cancel'
                          data-dismiss='modal'
                          type='button'
            Severity: Major
            Found in app/packs/src/vehicle_journeys/components/ConfirmModal.js and 1 other location - About 5 hrs to fix
            app/packs/src/journey_patterns/components/ConfirmModal.js on lines 19..36

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

            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-footer'>
                          <button
                            className='btn btn-cancel'
                            data-dismiss='modal'
                            type='button'
            Severity: Major
            Found in app/packs/src/journey_patterns/components/ConfirmModal.js and 1 other location - About 5 hrs to fix
            app/packs/src/vehicle_journeys/components/ConfirmModal.js on lines 12..29

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

            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 43 functions (exceeds 20 allowed). Consider refactoring.
            Open

            const actions = {
              weekDays: (index) => {
                return range(1, 8).map(n => I18n.t('time_tables.edit.metas.days')[n])
              },
              strToArrayDayTypes: (str) =>{
            Severity: Minor
            Found in app/packs/src/time_tables/actions/index.js - About 5 hrs to fix

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

                                        <div className='col-lg-6 col-md-6 col-sm-6 col-xs-12'>
                                          <div className='form-group'>
                                            <label className='control-label'>{I18n.attribute_name('vehicle_journey', 'published_journey_identifier')}</label>
                                            <input
                                              type='text'
              app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 71..83

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

              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='col-lg-6 col-md-6 col-sm-6 col-xs-12'>
                                            <div className='form-group'>
                                              <label className='control-label'>{I18n.attribute_name('vehicle_journey', 'journey_name')}</label>
                                              <input
                                                type='text'
              app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 98..110

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

              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

              Method full_transport_modes has 143 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def full_transport_modes
                    {
                      metro: [
                        :undefined,
                        :metro,
              Severity: Major
              Found in app/models/concerns/transport_mode_enumerations.rb - About 5 hrs to fix
                Severity
                Category
                Status
                Source
                Language