af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

const mapStateToProps = (state, ownProps) => {
  return {
    disabled: ownProps.disabled,
    modal: state.modal,
    vehicleJourneys: state.vehicleJourneys,
app/packs/src/vehicle_journeys/containers/tools/SelectSpecificStop.js on lines 5..15

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

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

const mapStateToProps = (state, ownProps) => {
  return {
    editMode: state.editMode,
    modal: state.modal,
    vehicleJourneys: state.vehicleJourneys,
app/packs/src/vehicle_journeys/containers/tools/AddVehicleJourney.js on lines 5..15

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

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

export const lineStyle = ([_line, ...waypoints]) => {
    const styles = [
        new Style({
            stroke: new Stroke({
                color: '#007fbb',
Severity: Major
Found in app/packs/src/helpers/open_layers/styles.js - About 2 hrs to fix

    File journey_pattern.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Chouette
      class JourneyPattern < Referential::Model
        include CustomFieldsSupport
        has_metadata
    
    
    Severity: Minor
    Found in app/models/chouette/journey_pattern.rb - About 2 hrs to fix

      Method validate_date_values has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate_date_values
            date_values_are_valid = date_values.all?(&:valid?)
      
            date_values.each do |date_value|
              if date_values.count { |d| d.value == date_value.value } > 1
      Severity: Minor
      Found in app/models/concerns/date_support.rb - About 2 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 force_register_models_with_checksum has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.force_register_models_with_checksum
          paths = Rails.application.paths['app/models'].to_a
          Rails.application.railties.each do |tie|
            next unless tie.respond_to? :paths
            paths += tie.paths['app/models'].to_a
      Severity: Minor
      Found in app/models/referential.rb - About 2 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 wrong_calendar_data? has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def wrong_calendar_data? entry
          content = entry.get_input_stream.read
          periods = STIF::NetexFile::Frame.parse_calendars content.to_s
          periods.each do |period|
      
      
      Severity: Minor
      Found in app/services/zip_service.rb - About 2 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 className='modal-header'>
                          <h4 className='modal-title'>{I18n.t('vehicle_journeys.form.slide_title', {id: id})}</h4>
                          <span type="button" className="close modal-close" data-dismiss="modal">&times;</span>
                        </div>
      app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js on lines 135..138

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

      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-header'>
                          <h4 className='modal-title'>{I18n.t('vehicle_journeys.form.specific_stops_title', {id: id})}</h4>
                          <span type="button" className="close modal-close" data-dismiss="modal">&times;</span>
                        </div>
      app/packs/src/vehicle_journeys/components/tools/ShiftVehicleJourney.js on lines 59..62

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

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

            def initialize_custom_field
              custom_field_code = self.code
              _attr_name = attr_name
              _uploader_name = uploader_name
              _digest_name = digest_name
      Severity: Major
      Found in app/models/custom_field.rb - About 2 hrs to fix

        Class Decorator has 21 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class Decorator < SimpleDelegator
                def initialize(route, journey_patterns, scheduled_stop_points: nil, route_points: nil, directions: nil,
                               destination_displays: nil, line_provider: nil, code_builder: nil)
                  super route
        
        
        Severity: Minor
        Found in app/models/import/netex_generic.rb - About 2 hrs to fix

          Class Workbench has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Workbench < Import::Base
              include ImportResourcesSupport
          
              after_commit :launch_worker, on: :create
          
          
          Severity: Minor
          Found in app/models/import/workbench.rb - About 2 hrs to fix

            Class NetexImportCreator has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class NetexImportCreator
              include Measurable
              attr_reader :attributes, :file
            
              def initialize(workbench, attributes = {})
            Severity: Minor
            Found in app/services/netex_import_creator.rb - About 2 hrs to fix

              Class AutocompleteController has 21 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class AutocompleteController < Chouette::UserController
                include WithinWorkgroup
              
                ##############
                # Line scope #
              Severity: Minor
              Found in app/controllers/autocomplete_controller.rb - About 2 hrs to fix

                Class TransportMode has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class TransportMode
                    attr_reader :mode, :sub_mode
                
                    def initialize(mode, sub_mode = nil)
                      @mode = mode&.to_sym
                Severity: Minor
                Found in app/lib/chouette/transport_mode.rb - About 2 hrs to fix

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

                  Metas.propTypes = {
                    metas: PropTypes.object.isRequired,
                    onUpdateDayTypes: PropTypes.func.isRequired,
                    onUpdateShared: PropTypes.func.isRequired,
                    onUpdateColor: PropTypes.func.isRequired,
                  Severity: Major
                  Found in app/packs/src/time_tables/components/Metas.js and 4 other locations - About 2 hrs to fix
                  app/packs/src/routes/components/form/SwitchInput.js on lines 24..30
                  app/packs/src/time_tables/components/PeriodList.js on lines 84..90
                  app/packs/src/vehicle_journeys/components/tools/CodesInputs.js on lines 86..92
                  app/packs/src/vehicle_journeys/components/tools/NotesEditVehicleJourney.js on lines 184..190

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

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

                  SwitchInput.proptypes = {
                    inputId: PropTypes.string.isRequired,
                    inputName: PropTypes.string.isRequired,
                    labelText: PropTypes.string.isRequired,
                    isChecked: PropTypes.bool.isRequired,
                  Severity: Major
                  Found in app/packs/src/routes/components/form/SwitchInput.js and 4 other locations - About 2 hrs to fix
                  app/packs/src/time_tables/components/Metas.js on lines 111..117
                  app/packs/src/time_tables/components/PeriodList.js on lines 84..90
                  app/packs/src/vehicle_journeys/components/tools/CodesInputs.js on lines 86..92
                  app/packs/src/vehicle_journeys/components/tools/NotesEditVehicleJourney.js on lines 184..190

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

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

                  PeriodList.propTypes = {
                    metas: PropTypes.object.isRequired,
                    timetable: PropTypes.object.isRequired,
                    status: PropTypes.object.isRequired,
                    onDeletePeriod: PropTypes.func.isRequired,
                  Severity: Major
                  Found in app/packs/src/time_tables/components/PeriodList.js and 4 other locations - About 2 hrs to fix
                  app/packs/src/routes/components/form/SwitchInput.js on lines 24..30
                  app/packs/src/time_tables/components/Metas.js on lines 111..117
                  app/packs/src/vehicle_journeys/components/tools/CodesInputs.js on lines 86..92
                  app/packs/src/vehicle_journeys/components/tools/NotesEditVehicleJourney.js on lines 184..190

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

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

                  NotesEditVehicleJourney.propTypes = {
                    onOpenNotesEditModal: PropTypes.func.isRequired,
                    onModalClose: PropTypes.func.isRequired,
                    onToggleFootnoteModal: PropTypes.func.isRequired,
                    onNotesEditVehicleJourney: PropTypes.func.isRequired,
                  app/packs/src/routes/components/form/SwitchInput.js on lines 24..30
                  app/packs/src/time_tables/components/Metas.js on lines 111..117
                  app/packs/src/time_tables/components/PeriodList.js on lines 84..90
                  app/packs/src/vehicle_journeys/components/tools/CodesInputs.js on lines 86..92

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

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

                  CodesInputs.propTypes = {
                    onUpdateReferentialCode: PropTypes.func.isRequired,
                    onDeleteReferentialCode: PropTypes.func.isRequired,
                    onAddReferentialCode: PropTypes.func.isRequired,
                    values: PropTypes.array.isRequired,
                  app/packs/src/routes/components/form/SwitchInput.js on lines 24..30
                  app/packs/src/time_tables/components/Metas.js on lines 111..117
                  app/packs/src/time_tables/components/PeriodList.js on lines 84..90
                  app/packs/src/vehicle_journeys/components/tools/NotesEditVehicleJourney.js on lines 184..190

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

                  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