af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

                              <input
                                type='number'
                                name='duplicate_time_mm'
                                ref='duplicate_time_mm'
                                min='00'
app/packs/src/vehicle_journeys/components/tools/DuplicateVehicleJourney.js on lines 109..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 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

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

  render() {
    this.previousBreakpoint = undefined
    let detailed_calendars = this.hasFeature('detailed_calendars') && !this.isReturn && !isEmpty(this.allTimeTables)
    requestAnimationFrame(function(){
      $(document).trigger("table:updated")
Severity: Major
Found in app/packs/src/vehicle_journeys/components/VehicleJourneysList.js - About 4 hrs to fix

    File vehicleJourneys.js has 360 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import _ from 'lodash'
    import actions from '../actions'
    
    const vehicleJourney= (state = {}, action, keep) => {
      switch (action.type) {
    Severity: Minor
    Found in app/packs/src/vehicle_journeys/reducers/vehicleJourneys.js - About 4 hrs to fix

      Function stopPoints has 116 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const stopPoints = (state = [], action) => {
        switch (action.type) {
          case 'ADD_STOP':
            return [
              ...state,
      Severity: Major
      Found in app/packs/src/routes/reducers/stopPoints.js - About 4 hrs to fix

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

                      <button
                        onClick={e => {
                          e.preventDefault()
                          dispatch(actions.checkConfirmModal(e, actions.goToPreviousPage(dispatch, pagination), pagination.stateChanged, dispatch))
                        }}
        Severity: Major
        Found in app/packs/src/journey_patterns/components/Navigate.js and 1 other location - About 4 hrs to fix
        app/packs/src/journey_patterns/components/Navigate.js on lines 37..48

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

        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

                      <button
                        onClick={e => {
                          e.preventDefault()
                          dispatch(actions.checkConfirmModal(e, actions.goToNextPage(dispatch, pagination), pagination.stateChanged, dispatch))
                        }}
        Severity: Major
        Found in app/packs/src/journey_patterns/components/Navigate.js and 1 other location - About 4 hrs to fix
        app/packs/src/journey_patterns/components/Navigate.js on lines 25..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 127.

        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

                  <button
                    onClick={e => {
                      e.preventDefault()
                      dispatch(actions.checkConfirmModal(e, actions.goToNextPage(dispatch, pagination, filters.queryString), pagination.stateChanged, dispatch))
                    }}
        Severity: Major
        Found in app/packs/src/vehicle_journeys/components/Navigate.js and 1 other location - About 4 hrs to fix
        app/packs/src/vehicle_journeys/components/Navigate.js on lines 23..32

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

        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

                  <button
                    onClick={e => {
                      e.preventDefault()
                      dispatch(actions.checkConfirmModal(e, actions.goToPreviousPage(dispatch, pagination, filters.queryString), pagination.stateChanged, dispatch))
                    }}
        Severity: Major
        Found in app/packs/src/vehicle_journeys/components/Navigate.js and 1 other location - About 4 hrs to fix
        app/packs/src/vehicle_journeys/components/Navigate.js on lines 33..42

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

        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

        Class Neptune has 35 methods (exceeds 20 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 4 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', 'transport_submode')}</label>
                                        <input
                                          type='text'
          app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 126..136

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

          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', 'transport_mode')}</label>
                                        <input
                                          type='text'
          app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 137..147

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

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

            def each(collection_or_opts={}, opts = {})
              if collection_or_opts.is_a? Hash
                collection = nil
                opts = collection_or_opts
              else
          Severity: Minor
          Found in app/models/concerns/iev_interfaces/resource.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

          Method import_routes has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

            def import_routes
              @lines_by_registration_number = {}
          
              CustomFieldsSupport.within_workgroup(workbench.workgroup) do
                create_resource(:routes).each(source.routes, transaction: true) do |route, resource|
          Severity: Minor
          Found in app/models/import/gtfs.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

          Function timetable has 105 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function timetable(state = {}, action) {
            let newState, newPeriods, newDates, newCM
            switch (action.type) {
              case 'RECEIVE_TIME_TABLES':
                let fetchedState = assign({}, state, {
          Severity: Major
          Found in app/packs/src/time_tables/reducers/timetable.js - About 4 hrs to fix

            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/EditModal.js and 1 other location - About 4 hrs to fix
            app/packs/src/journey_patterns/components/CreateModal.js on lines 132..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 118.

            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/CreateModal.js and 1 other location - About 4 hrs to fix
            app/packs/src/journey_patterns/components/EditModal.js on lines 153..169

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

            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

                      <button
                        type='button'
                        disabled={(actions.getSelected(this.props.vehicleJourneys).length != 1 || this.props.disabled)}
                        data-toggle='modal'
                        data-target='#ShiftVehicleJourneyModal'
            app/packs/src/vehicle_journeys/components/tools/DuplicateVehicleJourney.js on lines 80..89

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

            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

                      <button
                        type='button'
                        disabled={(actions.getSelected(this.props.vehicleJourneys).length == 0 || this.props.disabled)}
                        data-toggle='modal'
                        data-target='#DuplicateVehicleJourneyModal'
            app/packs/src/vehicle_journeys/components/tools/ShiftVehicleJourney.js on lines 44..53

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

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

            export default function modal(state = {}, action) {
              switch (action.type) {
                case 'OPEN_CONFIRM_MODAL':
                  $('#ConfirmModal').modal('show')
                  return _.assign({}, state, {
            Severity: Minor
            Found in app/packs/src/vehicle_journeys/reducers/modal.js - 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

            Function useMapController has 102 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function useMapController() {
              const SimplifiedLineBuilder = useMemo(() => {
                const getSectionsWithoutState = state => line => getLineSections(line || getGeometry(state), getWaypoints(state))
            
                return {
            Severity: Major
            Found in app/packs/src/shape_editor/controllers/ui/useMapController.js - About 4 hrs to fix
              Severity
              Category
              Status
              Source
              Language