af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

    case 'DELETE_CONSTRAINT_ZONE_MODAL':
        newModalProps = JSON.parse(JSON.stringify(state.modalProps))
        selectedConstraintZones = state.modalProps.selectedConstraintZones.slice(0)
        selectedConstraintZones.map((zone_id, i) =>{
          if(zone_id == parseInt(action.constraintZone.id)){
Severity: Major
Found in app/packs/src/vehicle_journeys/reducers/modal.js and 1 other location - About 5 hrs to fix
app/packs/src/vehicle_journeys/reducers/modal.js on lines 203..212

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

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

  render() {
    const {
      editMode, journeyPattern, status, type,
      onModalClose, onOpenCreateModal, onSelectShape, onUnselectShape
    } = this.props
Severity: Major
Found in app/packs/src/journey_patterns/components/CreateModal.js - About 5 hrs to fix

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

      render() {
        if(this.props.status.isFetching == true) {
          return false
        }
        if(this.props.status.fetchSuccess == true) {

      Class Base has 38 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Import::Base < ApplicationModel
        self.table_name = "imports"
        include OptionsSupport
        include NotifiableSupport
        include PurgeableResource
      Severity: Minor
      Found in app/models/import/base.rb - About 5 hrs to fix

        Function CopyModal has 124 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const CopyModal = props => {
          const copyContentRef = useRef(null)
          const pasteContentRef = useRef(null)
        
          const {
        Severity: Major
        Found in app/packs/src/vehicle_journeys/components/CopyModal.js - About 4 hrs to fix

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

                                <div className='col-xs-6'>
                                  <div className='form-group'>
                                    <label className='control-label'>{I18n.attribute_name('journey_pattern', 'published_name')}</label>
                                    <input
                                      type='text'
          Severity: Major
          Found in app/packs/src/journey_patterns/components/EditModal.js and 1 other location - About 4 hrs to fix
          app/packs/src/journey_patterns/components/EditModal.js on lines 98..111

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

          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-xs-6'>
                                  <div className='form-group'>
                                    <label className='control-label'>{I18n.attribute_name('journey_pattern', 'registration_number')}</label>
                                    <input
                                      type='text'
          Severity: Major
          Found in app/packs/src/journey_patterns/components/EditModal.js and 1 other location - About 4 hrs to fix
          app/packs/src/journey_patterns/components/EditModal.js on lines 84..97

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

          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

            class ComputeJourneyPatternDurations < Macro::Base
              class Run < Macro::Base::Run
                def run
                  journey_patterns.find_in_batches do |batch|
                    Batch.new(batch).journey_pattern_durations do |journey_pattern, durations|
          Severity: Major
          Found in app/models/macro/compute_journey_pattern_durations.rb and 1 other location - About 4 hrs to fix
          app/models/macro/compute_journey_pattern_distances.rb on lines 4..140

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

          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

            class ComputeJourneyPatternDistances < Macro::Base
              class Run < Macro::Base::Run
                def run
                  journey_patterns.find_in_batches do |batch|
                    Batch.new(batch).journey_pattern_distances do |journey_pattern, distances|
          Severity: Major
          Found in app/models/macro/compute_journey_pattern_distances.rb and 1 other location - About 4 hrs to fix
          app/models/macro/compute_journey_pattern_durations.rb on lines 4..127

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

          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 fill_passing_times! has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
          Open

              def fill_passing_times!
                encountered_empty_vjas = []
                previous_stop = nil
                vehicle_journey_at_stops.each do |vjas|
                  sp = vjas.stop_point
          Severity: Minor
          Found in app/models/chouette/vehicle_journey.rb - About 4 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

          Identical 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/ConstraintExclusionEditVehicleJourney.js on lines 256..275

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

          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

                                {
                                  this.props.editMode &&
                                  <div className='modal-footer'>
                                    <button
                                      className='btn btn-cancel'
          app/packs/src/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js on lines 116..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 132.

          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 updater.rb has 368 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Chouette
            module Sync
              class Updater
                include Measurable
          
          
          Severity: Minor
          Found in app/lib/chouette/sync/updater.rb - About 4 hrs to fix

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

              render() {
                if(this.props.status.isFetching == true) {
                  return false
                }
                if(this.props.status.fetchSuccess == true) {

              Method checksum_parents has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.checksum_parents object
                  klass = object.class
                  return [] unless klass.respond_to? :checksum_parent_relations
                  return [] unless klass.checksum_parent_relations
              
              
              Severity: Minor
              Found in app/lib/chouette/checksum_manager.rb - About 4 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

                      <div style={{width: 120}}>
                        <select className='form-control' value={props.value.for_boarding} id="for_boarding" onChange={props.onSelectChange}>
                          <option value="normal">{I18n.t('routes.edit.stop_point.boarding.normal')}</option>
                          <option value="forbidden">{I18n.t('routes.edit.stop_point.boarding.forbidden')}</option>
                        </select>
              Severity: Major
              Found in app/packs/src/routes/components/StopPoint.js and 1 other location - About 4 hrs to fix
              app/packs/src/routes/components/StopPoint.js on lines 28..33

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

              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 style={{width: 120}}>
                        <select className='form-control' value={props.value.for_alighting} id="for_alighting" onChange={props.onSelectChange}>
                          <option value="normal">{I18n.t('routes.edit.stop_point.alighting.normal')}</option>
                          <option value="forbidden">{I18n.t('routes.edit.stop_point.alighting.forbidden')}</option>
                        </select>
              Severity: Major
              Found in app/packs/src/routes/components/StopPoint.js and 1 other location - About 4 hrs to fix
              app/packs/src/routes/components/StopPoint.js on lines 21..26

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

              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

              VehicleJourney.propTypes = {
                value: PropTypes.object.isRequired,
                filters: PropTypes.object.isRequired,
                index: PropTypes.number.isRequired,
                onUpdateTime: PropTypes.func.isRequired,
              Severity: Major
              Found in app/packs/src/vehicle_journeys/components/VehicleJourney.js and 1 other location - About 4 hrs to fix
              app/packs/src/vehicle_journeys/components/Filters.js on lines 188..198

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

              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

              Filters.propTypes = {
                filters : PropTypes.object.isRequired,
                pagination : PropTypes.object.isRequired,
                onFilter: PropTypes.func.isRequired,
                onResetFilters: PropTypes.func.isRequired,
              Severity: Major
              Found in app/packs/src/vehicle_journeys/components/Filters.js and 1 other location - About 4 hrs to fix
              app/packs/src/vehicle_journeys/components/VehicleJourney.js on lines 187..197

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

              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'
                                              name='duplicate_time_hh'
                                              ref='duplicate_time_hh'
                                              min='00'
              app/packs/src/vehicle_journeys/components/tools/DuplicateVehicleJourney.js on lines 121..131

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

              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