af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

    class Cache
      include Measurable
      def initialize(next_instance)
        @next_instance = next_instance
      end
Severity: Major
Found in app/lib/route_planner.rb and 1 other location - About 3 hrs to fix
app/lib/reverse_geocode.rb on lines 106..157

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

export default function PasteButton({onClick, disabled, selectionMode}) {
  return (
    <li className='st_action'>
      <button
        type='button'
app/packs/src/vehicle_journeys/components/tools/CopyButton.js on lines 4..20

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 109.

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

export default function CopyButton({ onClick, disabled }) {
  return (
    <li className='st_action'>
      <button
        type='button'
app/packs/src/vehicle_journeys/components/tools/PasteButton.js on lines 6..22

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

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

const actions = {
  enterEditMode: () => ({
    type: "ENTER_EDIT_MODE"
  }),
  exitEditMode: () => ({
Severity: Minor
Found in app/packs/src/journey_patterns/actions/index.js - About 3 hrs to fix

    Class Period has 30 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Period < Range
      extend ActiveModel::Naming
      include ActiveModel::Validations
    
      alias start_date begin
    Severity: Minor
    Found in app/lib/period.rb - About 3 hrs to fix

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

        modal: {
          type: '',
          modalProps: {
            active: false,
            begin: {
      Severity: Major
      Found in app/packs/entrypoints/time_tables/edit.js and 1 other location - About 3 hrs to fix
      app/packs/entrypoints/calendars/edit.js on lines 35..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 108.

      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

        modal: {
          type: '',
          modalProps: {
            active: false,
            begin: {
      Severity: Major
      Found in app/packs/entrypoints/calendars/edit.js and 1 other location - About 3 hrs to fix
      app/packs/entrypoints/time_tables/edit.js on lines 37..55

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

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

        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, metas, timetable))
                        }}
        Severity: Major
        Found in app/packs/src/time_tables/components/Navigate.js and 1 other location - About 3 hrs to fix
        app/packs/src/time_tables/components/Navigate.js on lines 59..68

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

        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), pagination.stateChanged, dispatch, metas, timetable))
                        }}
        Severity: Major
        Found in app/packs/src/time_tables/components/Navigate.js and 1 other location - About 3 hrs to fix
        app/packs/src/time_tables/components/Navigate.js on lines 69..78

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

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

          def import_lines
            each_element_matching_css('ChouettePTNetwork') do |source_pt_network, filename, progress|
              file_company = get_associated_company(source_pt_network, filename)
              file_network = get_associated_network(source_pt_network, filename)
        
        
        Severity: Minor
        Found in app/models/import/neptune.rb - About 3 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 fetchVehicleJourneys has 88 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          fetchVehicleJourneys : (dispatch, currentPage, nextPage, queryString, url) => {
            let returnJourneys = false
            if(currentPage == undefined){
              currentPage = 1
            }
        Severity: Major
        Found in app/packs/src/vehicle_journeys/actions/index.js - About 3 hrs to fix

          Class JourneyPattern has 29 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class JourneyPattern < Chouette::TridentActiveRecord
              has_metadata
              include ChecksumSupport
              include CustomFieldsSupport
              include ObjectidSupport
          Severity: Minor
          Found in app/models/chouette/journey_pattern.rb - About 3 hrs to fix

            Class Route has 29 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Route < Chouette::TridentActiveRecord
                has_metadata
            
                attr_accessor :prevent_costs_calculation
            
            
            Severity: Minor
            Found in app/models/chouette/route.rb - About 3 hrs to fix

              File JourneyPattern.js has 311 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react'
              import PropTypes from 'prop-types'
              import { Path } from 'path-parser'
              import Alpine from 'alpinejs'
              
              
              Severity: Minor
              Found in app/packs/src/journey_patterns/components/JourneyPattern.js - About 3 hrs to fix

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

                        if(vj.ignored_stop_area_routing_constraint_ids){
                          vj.ignored_stop_area_routing_constraint_ids.map((exclusion, j) =>{
                            let found = false
                            uniqStopAreasExclusions.map((id, i)=>{
                              if(id == parseInt(exclusion)){
                Severity: Major
                Found in app/packs/src/vehicle_journeys/reducers/modal.js and 1 other location - About 3 hrs to fix
                app/packs/src/vehicle_journeys/reducers/modal.js on lines 83..95

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

                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

                        if(vj.ignored_routing_contraint_zone_ids){
                          vj.ignored_routing_contraint_zone_ids.map((exclusion, j) =>{
                            let found = false
                            uniqExclusions.map((id, i)=>{
                              if(id == parseInt(exclusion)){
                Severity: Major
                Found in app/packs/src/vehicle_journeys/reducers/modal.js and 1 other location - About 3 hrs to fix
                app/packs/src/vehicle_journeys/reducers/modal.js on lines 96..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 104.

                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 index.js has 309 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import assign from 'lodash/assign'
                import range from 'lodash/range'
                import reject from 'lodash/reject'
                import some from 'lodash/some'
                import every from 'lodash/every'
                Severity: Minor
                Found in app/packs/src/time_tables/actions/index.js - About 3 hrs to fix

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

                  PeriodForm.propTypes = {
                    modal: PropTypes.object.isRequired,
                    metas: PropTypes.object.isRequired,
                    onOpenAddPeriodForm: PropTypes.func.isRequired,
                    onClosePeriodForm: PropTypes.func.isRequired,
                  Severity: Major
                  Found in app/packs/src/time_tables/components/PeriodForm.js and 3 other locations - About 3 hrs to fix
                  app/packs/src/routes/components/StopPointList.js on lines 67..75
                  app/packs/src/routes/components/form/TextInput.js on lines 20..28
                  app/packs/src/vehicle_journeys/components/SaveVehicleJourneys.js on lines 20..28

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

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

                  StopPointList.propTypes = {
                    stopPoints: PropTypes.array.isRequired,
                    onDeleteClick: PropTypes.func.isRequired,
                    onMoveUpClick: PropTypes.func.isRequired,
                    onMoveDownClick: PropTypes.func.isRequired,
                  Severity: Major
                  Found in app/packs/src/routes/components/StopPointList.js and 3 other locations - About 3 hrs to fix
                  app/packs/src/routes/components/form/TextInput.js on lines 20..28
                  app/packs/src/time_tables/components/PeriodForm.js on lines 143..151
                  app/packs/src/vehicle_journeys/components/SaveVehicleJourneys.js on lines 20..28

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

                  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