af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 149.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 149.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method full_transport_modes has 138 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

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

            return (
              <div className='td'>
                <button
                  type='button'
                  className={'btn btn-circle' + (this.props.value.current_month[this.props.index].excluded_date ? ' active' : '')}
    Severity: Major
    Found in app/packs/src/time_tables/components/ExceptionsInDay.js and 1 other location - About 5 hrs to fix
    app/packs/src/time_tables/components/ExceptionsInDay.js on lines 39..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 145.

    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

            return (
              <div className='td'>
                <button
                  type='button'
                  className={'btn btn-circle'  + (this.props.value.current_month[this.props.index].include_date ? ' active' : '')}
    Severity: Major
    Found in app/packs/src/time_tables/components/ExceptionsInDay.js and 1 other location - About 5 hrs to fix
    app/packs/src/time_tables/components/ExceptionsInDay.js on lines 23..37

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

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

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 144.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

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

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 144.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

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

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 144.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function render has 135 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/CreateModal.js - About 5 hrs to fix

      Class Gtfs has 40 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Import::Gtfs < Import::Base # rubocop:disable Metrics/ClassLength
        include LocalImportSupport
      
        after_commit :update_main_resource_status, on:  [:create, :update]
      
      
      Severity: Minor
      Found in app/models/import/gtfs.rb - About 5 hrs to fix

        Method import_stop_areas has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

          def import_stop_areas
            @parent_stop_areas = {}
            stop_area_registration_numbers = Set.new
        
            each_element_matching_css('ChouettePTNetwork ChouetteArea') do |source_parent, _, progress|
        Severity: Minor
        Found in app/models/import/neptune.rb - About 5 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

                              {
                                this.props.editMode &&
                                <div className='modal-footer'>
                                  <button
                                    className='btn btn-cancel'
        app/packs/src/vehicle_journeys/components/tools/NotesEditVehicleJourney.js on lines 149..168

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 140.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          stringInput(cf){
            return(
              <input
                type='text'
                ref={'custom_fields.' + cf.code}
        Severity: Major
        Found in app/packs/src/helpers/CustomFieldsInputs.js and 1 other location - About 5 hrs to fix
        app/packs/src/helpers/CustomFieldsInputs.js on lines 60..71

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 140.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                              {
                                this.props.editMode &&
                                <div className='modal-footer'>
                                  <button
                                    className='btn btn-cancel'
        app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js on lines 180..199

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 140.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          integerInput(cf){
            return(
              <input
                type='number'
                ref={'custom_fields.' + cf.code}
        Severity: Major
        Found in app/packs/src/helpers/CustomFieldsInputs.js and 1 other location - About 5 hrs to fix
        app/packs/src/helpers/CustomFieldsInputs.js on lines 47..58

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 140.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                  <button
                    type='button'
                    disabled={(actions.getSelected(this.props.vehicleJourneys).length < 1 || this.props.disabled)}
                    data-toggle='modal'
                    data-target='#CalendarsEditVehicleJourneyModal'
        app/packs/src/vehicle_journeys/components/tools/ConstraintExclusionEditVehicleJourney.js on lines 117..126

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 140.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                  <button
                    type='button'
                    disabled={(actions.getSelected(this.props.vehicleJourneys).length < 1 || this.props.disabled)}
                    data-toggle='modal'
                    data-target='#ConstraintExclusionEditVehicleJourney'
        app/packs/src/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js on lines 31..40

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 140.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

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

          File custom_field.rb has 382 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class CustomField < ApplicationModel
          
            extend Enumerize
            belongs_to :workgroup
            belongs_to :custom_field_group, optional: true
          Severity: Minor
          Found in app/models/custom_field.rb - About 5 hrs to fix

            Class Source has 39 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Source < ApplicationModel
              extend Enumerize
              belongs_to :workbench, optional: false
            
              has_many :retrievals, class_name: "Source::Retrieval", foreign_key: "source_id", dependent: :destroy
            Severity: Minor
            Found in app/models/source.rb - About 5 hrs to fix
              Severity
              Category
              Status
              Source
              Language