af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

  render() {
    const {
      route,
      isOutbound,
      errors,
Severity: Major
Found in app/packs/src/routes/components/form/index.js - About 2 hrs to fix

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

        } else {
          return <button
            type='button'
            className='btn btn-primary btn-xs'
            onClick={() => this.props.onToggleFootnoteModal(lf, true)}
    app/packs/src/vehicle_journeys/components/tools/NotesEditVehicleJourney.js on lines 37..43

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

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

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

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

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

    Refactorings

    Further Reading

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

        if (this.footnotes().associated.includes(lf)) {
          return <button
            type='button'
            className='btn btn-outline-danger btn-xs'
            onClick={() => this.props.onToggleFootnoteModal(lf, false)}
    app/packs/src/vehicle_journeys/components/tools/NotesEditVehicleJourney.js on lines 43..49

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

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

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

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

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

    Refactorings

    Further Reading

    File newapplication_helper.rb has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module NewapplicationHelper
    
      # Table Builder
      def table_builder collection, columns, actions, selectable = [], cls = nil
        return unless collection.present?
    Severity: Minor
    Found in app/helpers/newapplication_helper.rb - About 2 hrs to fix

      File scope.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Export::Scope
        def self.build(referential, **options)
          Options.new(referential, options).scope
        end
      
      
      Severity: Minor
      Found in app/models/export/scope.rb - About 2 hrs to fix

        File vehicle_journey_at_stop.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Chouette
          class VehicleJourneyAtStop < ::ActiveRecord::Base
            include Chouette::ForBoardingEnumerations
            include Chouette::ForAlightingEnumerations
            include ChecksumSupport
        Severity: Minor
        Found in app/models/chouette/vehicle_journey_at_stop.rb - About 2 hrs to fix

          Function createSelect2 has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function createSelect2(WrappedComponent) {
            class Select2 extends Component {
              constructor(props) {
                super(props)
                this.handleChange = this.handleChange.bind(this)
          Severity: Minor
          Found in app/packs/src/helpers/select2/select2.js - About 1 hr to fix

            Method candidate_target_attributes has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def candidate_target_attributes # rubocop:disable Metrics/MethodLength
                    Chouette::ModelAttribute.collection do
            
                      # Chouette::Company
                      select Chouette::Company, :short_name
            Severity: Minor
            Found in app/models/macro/define_attribute_from_particulars.rb - About 1 hr to fix

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

              document.addEventListener("DOMContentLoaded", () => {
                if (document.getElementById("journey_patterns")) {
                  render(
                    <Provider store={store}>
                      <App />
              Severity: Major
              Found in app/packs/entrypoints/journey_patterns/index.js and 2 other locations - About 1 hr to fix
              app/packs/entrypoints/routes/form.js on lines 13..22
              app/packs/entrypoints/time_tables/edit.js on lines 64..73

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

              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

              document.addEventListener("DOMContentLoaded", () => {
                if (document.getElementById("periods")) {
                  render(
                    <Provider store={store}>
                      <App />
              Severity: Major
              Found in app/packs/entrypoints/time_tables/edit.js and 2 other locations - About 1 hr to fix
              app/packs/entrypoints/journey_patterns/index.js on lines 39..48
              app/packs/entrypoints/routes/form.js on lines 13..22

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 74.

              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

              document.addEventListener("DOMContentLoaded", () => {
                if (document.getElementById("route")) {
                  render(
                    <Provider store={store}>
                      <App />
              Severity: Major
              Found in app/packs/entrypoints/routes/form.js and 2 other locations - About 1 hr to fix
              app/packs/entrypoints/journey_patterns/index.js on lines 39..48
              app/packs/entrypoints/time_tables/edit.js on lines 64..73

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

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

              export default function modal(state = {}, action) {
                switch (action.type) {
                  case 'OPEN_CONFIRM_MODAL':
                    $('#ConfirmModal').modal('show')
                    return assign({}, state, {
              Severity: Minor
              Found in app/packs/src/time_tables/reducers/modal.js - About 1 hr to fix

                Method candidate_target_attributes has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def candidate_target_attributes # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
                        Chouette::ModelAttribute.collection do # rubocop:disable Metrics/BlockLength
                          select Chouette::StopArea, :name
                          select Chouette::StopArea, :parent
                          select Chouette::StopArea, :country_code
                Severity: Minor
                Found in app/models/macro/update_attribute_from_referent_to_particulars.rb - About 1 hr to fix

                  Method parse_options has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def parse_options args
                        options = {}
                        %i(weight primary secondary footer on action actions policy feature if groups group before_block).each do |k|
                          options[k] = args.delete(k) if args.has_key?(k)
                        end
                  Severity: Minor
                  Found in app/lib/af83/decorator/enhanced_decorator.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 expand_multiparameter_attributes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def expand_multiparameter_attributes(attributes)
                      attributes ||= {}
                  
                      single_parameter_attributes = {}
                      multi_parameter_attributes = {}
                  Severity: Minor
                  Found in app/lib/activeattr_ext.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 3 locations. Consider refactoring.
                  Open

                    class Routes
                      def initialize(query_ctx, line_id)
                        @line_id = line_id
                        # Initialize the loading state for this query or get the previously-initiated state
                        @lazy_state = query_ctx[:lazy_find_routes] ||= {
                  Severity: Major
                  Found in app/graphql/lazy_loading/routes.rb and 2 other locations - About 1 hr to fix
                  app/graphql/lazy_loading/children.rb on lines 2..34
                  app/graphql/lazy_loading/route_stop_points.rb on lines 2..34

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

                  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

                    class Children
                      def initialize(query_ctx, stop_id)
                        @stop_id = stop_id
                        # Initialize the loading state for this query or get the previously-initiated state
                        @lazy_state = query_ctx[:lazy_find_children] ||= {
                  Severity: Major
                  Found in app/graphql/lazy_loading/children.rb and 2 other locations - About 1 hr to fix
                  app/graphql/lazy_loading/route_stop_points.rb on lines 2..34
                  app/graphql/lazy_loading/routes.rb on lines 2..34

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

                  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

                    class RouteStopPoints
                      def initialize(query_ctx, route_id)
                        @route_id = route_id
                        # Initialize the loading state for this query or get the previously-initiated state
                        @lazy_state = query_ctx[:lazy_find_route_stop_points] ||= {
                  Severity: Major
                  Found in app/graphql/lazy_loading/route_stop_points.rb and 2 other locations - About 1 hr to fix
                  app/graphql/lazy_loading/children.rb on lines 2..34
                  app/graphql/lazy_loading/routes.rb on lines 2..34

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

                  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

                                    <div className='modal-header'>
                                      <h4 className='modal-title'>{I18n.t('vehicle_journeys.actions.new')}</h4>
                                      <span type="button" className="close modal-close" data-dismiss="modal">&times;</span>
                                    </div>
                  app/packs/src/vehicle_journeys/components/tools/ConstraintExclusionEditVehicleJourney.js on lines 132..135
                  app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 62..65
                  app/packs/src/vehicle_journeys/components/tools/NotesEditVehicleJourney.js on lines 138..141
                  app/packs/src/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js on lines 46..49

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

                  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

                                    <div className='modal-header'>
                                      <h4 className='modal-title'>{I18n.t('vehicle_journeys.form.time_tables')}</h4>
                                      <span type="button" className="close modal-close" data-dismiss="modal">&times;</span>
                                    </div>
                  app/packs/src/vehicle_journeys/components/tools/ConstraintExclusionEditVehicleJourney.js on lines 132..135
                  app/packs/src/vehicle_journeys/components/tools/CreateModal.js on lines 56..59
                  app/packs/src/vehicle_journeys/components/tools/EditVehicleJourney.js on lines 62..65
                  app/packs/src/vehicle_journeys/components/tools/NotesEditVehicleJourney.js on lines 138..141

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

                  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