af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

  render() {
    return (
      <div
        className='period_manager'
        id={this.props.value.id}
Severity: Minor
Found in app/packs/src/time_tables/components/PeriodManager.js - About 1 hr to fix

    Method import_stop_areas has 44 lines of code (exceeds 25 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 1 hr to fix

      Function mapDispatchToProps has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      const mapDispatchToProps = (dispatch) => {
        return {
          onLoadFirstPage: (filters, routeUrl) =>{
            dispatch(actions.fetchingApi())
            actions.fetchVehicleJourneys(dispatch, undefined, undefined, filters.queryString, routeUrl)
      Severity: Minor
      Found in app/packs/src/vehicle_journeys/containers/VehicleJourneysList.js - About 1 hr 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 render has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        render() {
          let fetched = true
          if(this.constraint_zones === null) {
            this.fetch_constraint_zones()
            fetched = false

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

          def ransack_transport_mode scope
            return scope unless params[:q].try(:[], :transport_mode) || params[:q].try(:[], :transport_submode)
      
            @transport_modes = params[:q][:transport_mode].keys  if params[:q].has_key?(:transport_mode)
            @transport_submodes = params[:q][:transport_submode].keys if params[:q].has_key?(:transport_submode)
      Severity: Minor
      Found in app/controllers/concerns/transport_mode_filter.rb - About 1 hr 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 resources_are_identifiers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def resources_are_identifiers
          resources.each do |resource_name, resource|
            unless resource.attributes?
              errors.add resource_name, "resource  required"
              next
      Severity: Minor
      Found in app/models/webhook_event.rb - About 1 hr 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 run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def run
              journey_patterns.find_in_batches(batch_size: 100) do |group|
                batch = workgroup.route_planner.batch
      
                factories_by_ids = {}
      Severity: Minor
      Found in app/models/macro/create_shape.rb - About 1 hr 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={`select2-bootstrap-append ${hasError && 'has-error'}`}>
                <BSelect2 {...this.props} onSelect={ this.onChange.bind(this) }/>
                { hasError && <span className='help-block small'>{I18n.t('activerecord.errors.models.route.attributes.stop_points.empty_stop_point')}</span> }
              </div>
      Severity: Major
      Found in app/packs/src/routes/components/BSelect2.js and 1 other location - About 1 hr to fix
      app/packs/src/routes/components/BSelect2.js on lines 65..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 70.

      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>
                  <BSelect2 {...this.props} onSelect={ this.onChange.bind(this) }/>
                  { hasError && <span className='help-block small'>{I18n.t('activerecord.errors.models.route.attributes.stop_points.empty_stop_point')}</span> }
                </div>
      Severity: Major
      Found in app/packs/src/routes/components/BSelect2.js and 1 other location - About 1 hr to fix
      app/packs/src/routes/components/BSelect2.js on lines 57..60

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

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

        componentDidUpdate(prevProps, prevState) {
          if(this.props.status.isFetching == false){
            $('.table-2entries').each(function() {
              $(this).find('.th').css('height', 'auto')
              var refH = []
      Severity: Minor
      Found in app/packs/src/vehicle_journeys/components/VehicleJourneysList.js - About 1 hr to fix

        Method state_update has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def state_update state
            update_attributes(self.class.state_permited_attributes(state))
            self.calendar_id = nil if self.respond_to?(:calendar_id) && !state['calendar']
        
            days = state['day_types'].split(',')
        Severity: Minor
        Found in app/models/concerns/timetable_support.rb - About 1 hr to fix

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

              let noInputChanges = this.state.additional_time == 0 && this.state.originalDT.hour == this.state.duplicate_time_hh && this.state.originalDT.minute == this.state.duplicate_time_mm
          app/packs/src/vehicle_journeys/components/tools/DuplicateVehicleJourney.js on lines 185..185

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

          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

                                    className={'btn btn-default ' + (this.state.additional_time == 0 && this.state.originalDT.hour == this.state.duplicate_time_hh && this.state.originalDT.minute == this.state.duplicate_time_mm ? 'disabled' : '')}
          app/packs/src/vehicle_journeys/components/tools/DuplicateVehicleJourney.js on lines 69..69

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

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

            render() {
              if (!this.hasPolicy()) {
                return false
              }
              return (
          Severity: Minor
          Found in app/packs/src/helpers/cancel_button.js - About 1 hr to fix

            Function configs has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static get configs() {
                return {
                  default: {
                    valueField: 'id',
                    labelField: 'text',
            Severity: Minor
            Found in app/packs/entrypoints/inputs/tom_select.js - About 1 hr to fix

              Method checksum_parents has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.checksum_parents object
                  klass = object.class
                  return [] unless klass.respond_to? :checksum_parent_relations
                  return [] unless klass.checksum_parent_relations
              
              
              Severity: Minor
              Found in app/lib/chouette/checksum_manager.rb - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                    if(this.props.status.fetchSuccess == true) {
                      return (
                        <li className='st_action'>
                          <button
                            type='button'

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

                        class UserStatusFinalizer
                          def initialize(macro_list_run)
                            @macro_list_run = macro_list_run
                          end
                          attr_reader :macro_list_run
                  Severity: Major
                  Found in app/models/macro/list.rb and 1 other location - About 1 hr to fix
                  app/models/control/list.rb on lines 103..140

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 67.

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

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

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

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

                  Refactorings

                  Further Reading

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

                        class UserStatusFinalizer
                          def initialize(control_list_run)
                            @control_list_run = control_list_run
                          end
                          attr_reader :control_list_run
                  Severity: Major
                  Found in app/models/control/list.rb and 1 other location - About 1 hr to fix
                  app/models/macro/list.rb on lines 99..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 67.

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

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

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

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

                  Refactorings

                  Further Reading

                  Method fill_passing_times! has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def fill_passing_times!
                        encountered_empty_vjas = []
                        previous_stop = nil
                        vehicle_journey_at_stops.each do |vjas|
                          sp = vjas.stop_point
                  Severity: Minor
                  Found in app/models/chouette/vehicle_journey.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language