af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

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

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

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

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 127.

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

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

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

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

    Refactorings

    Further Reading

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

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

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 127.

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

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

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

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

    Refactorings

    Further Reading

    Method creation_tag has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

      def creation_tag(object)
        field_set_tag t("layouts.history_tag.title"), :class => "history_tag" do
          content_tag :ul do
            [(content_tag :li do
              if object.has_attribute?(:created_at)
    Severity: Minor
    Found in app/helpers/history_helper.rb - About 4 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

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

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 126.

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

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

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

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

    Refactorings

    Further Reading

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

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

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 126.

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

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

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

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

    Refactorings

    Further Reading

    Class Base has 35 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Import::Base < ApplicationModel
      self.table_name = "imports"
      include OptionsSupport
      include NotifiableSupport
      include PurgeableResource
    Severity: Minor
    Found in app/models/import/base.rb - About 4 hrs to fix

      Class Neptune has 35 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Import::Neptune < Import::Base
        include LocalImportSupport
      
        def self.accepts_file?(file)
          ::Neptune::Source.accept?(file)
      Severity: Minor
      Found in app/models/import/neptune.rb - About 4 hrs to fix

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

                                  <div className='col-lg-6 col-md-6 col-sm-6 col-xs-12'>
                                    <div className='form-group'>
                                      <label className='control-label'>{I18n.attribute_name('vehicle_journey', 'transport_mode')}</label>
                                      <input
                                        type='text'
        app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 137..147

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 125.

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

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

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

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

        Refactorings

        Further Reading

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

                                  <div className='col-lg-6 col-md-6 col-sm-6 col-xs-12'>
                                    <div className='form-group'>
                                      <label className='control-label'>{I18n.attribute_name('vehicle_journey', 'transport_submode')}</label>
                                      <input
                                        type='text'
        app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 126..136

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 125.

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

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

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

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

        Refactorings

        Further Reading

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

          def import_routes
            @lines_by_registration_number = {}
        
            CustomFieldsSupport.within_workgroup(workbench.workgroup) do
              create_resource(:routes).each(source.routes, transaction: true) do |route, resource|
        Severity: Minor
        Found in app/models/import/gtfs.rb - About 4 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

          def each(collection_or_opts={}, opts = {})
            if collection_or_opts.is_a? Hash
              collection = nil
              opts = collection_or_opts
            else
        Severity: Minor
        Found in app/models/concerns/iev_interfaces/resource.rb - About 4 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Class Base has 34 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Export::Base < ApplicationModel
          self.table_name = 'exports'
        
          include OptionsSupport
          include NotifiableSupport
        Severity: Minor
        Found in app/models/export/base.rb - About 4 hrs to fix

          Class StopPointDecorator has 34 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class StopPointDecorator < SimpleDelegator
          
              attr_accessor :journey_pattern_id, :route
              def initialize(stop_point, journey_pattern_id: nil, route: nil)
                super stop_point
          Severity: Minor
          Found in app/models/export/netex_generic.rb - About 4 hrs to fix

            Class VehicleJourney has 34 methods (exceeds 20 allowed). Consider refactoring.
            Open

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

              Method compute_for_referential has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                  def compute_for_referential(referential)
                    Chouette::Benchmark.measure 'service_counts', referential: referential.id do
                      referential_inserter = ReferentialInserter.new(referential) do |config|
                        config.add(IdInserter)
                        config.add(CopyInserter)
              Severity: Minor
              Found in app/models/service_count.rb - About 4 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              File updater.rb has 343 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Chouette
                module Sync
                  class Updater
                    include Measurable
              
              
              Severity: Minor
              Found in app/lib/chouette/sync/updater.rb - About 4 hrs to fix

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

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

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

                                        <div className='modal-footer'>
                                          <button
                                            className='btn btn-cancel'
                                            data-dismiss='modal'
                                            type='button'
                  Severity: Major
                  Found in app/packs/src/journey_patterns/components/CreateModal.js and 1 other location - About 4 hrs to fix
                  app/packs/src/journey_patterns/components/EditModal.js on lines 153..169

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 118.

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

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

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

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

                  Refactorings

                  Further Reading

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

                                      <div className='modal-footer'>
                                        <button
                                          className='btn btn-cancel'
                                          data-dismiss='modal'
                                          type='button'
                  Severity: Major
                  Found in app/packs/src/journey_patterns/components/EditModal.js and 1 other location - About 4 hrs to fix
                  app/packs/src/journey_patterns/components/CreateModal.js on lines 132..148

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 118.

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

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

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

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

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language