noesya/osuny

View on GitHub

Showing 49 of 70 total issues

Function setConfigs has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    setConfigs: function () {
        'use strict';
        this.setConfig('nothing',
            {
                toolbar: []
Severity: Major
Found in app/assets/javascripts/application/plugins/summernote.js - About 2 hrs to fix

    Method set_l10n_attributes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def set_l10n_attributes(base_params, resource)
        l10ns_attributes = base_params.delete(:localizations)
        base_params[:localizations_attributes] = []
        l10ns_attributes.each do |language_iso_code, l10n_params|
          language = Language.find_by(iso_code: language_iso_code)

    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 Origins has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Osuny::Media::Picker::Origins
      attr_reader :picker
      delegate  :params, :university, :about, :image, :image_property, :alt, :credit,
                to: :picker
    
    
    Severity: Minor
    Found in app/services/osuny/media/picker/origins.rb - About 2 hrs to fix

      Method upsert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

        def upsert
          organizations_params = params[:organizations] || []
          every_organization_has_migration_identifier = organizations_params.all? { |organization_params|
            organization_params[:migration_identifier].present?
          }
      Severity: Minor
      Found in app/controllers/api/osuny/university/organizations_controller.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 upsert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

        def upsert
          categories_params = params[:categories] || []
          every_category_has_migration_identifier = categories_params.all? { |category_params|
            category_params[:migration_identifier].present?
          }

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

        def upsert
          pages_params = params[:pages] || []
          every_page_has_migration_identifier = pages_params.all? { |page_params|
            page_params[:migration_identifier].present?
          }
      Severity: Minor
      Found in app/controllers/api/osuny/communication/websites/pages_controller.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 upsert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

        def upsert
          categories_params = params[:categories] || []
          every_category_has_migration_identifier = categories_params.all? { |category_params|
            category_params[:migration_identifier].present?
          }

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

        def upsert
          posts_params = params[:posts] || []
          every_post_has_migration_identifier = posts_params.all? { |post_params|
            post_params[:migration_identifier].present?
          }
      Severity: Minor
      Found in app/controllers/api/osuny/communication/websites/posts_controller.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 upsert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

        def upsert
          events_params = params[:events] || []
          every_event_has_migration_identifier = events_params.all? { |event_params|
            event_params[:migration_identifier].present?
          }

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

        def set_time_slots_attributes(permitted_params, event)
          time_slots_attributes = permitted_params.delete(:time_slots)
      
          time_slots_attributes.each do |time_slot_attributes|
            # Set the id of the time slot if it already exists

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

          initSortable: function () {
              'use strict';
              var nestedSortables,
                  i;
      
      
      Severity: Minor
      Found in app/assets/javascripts/admin/plugins/treeview.js - About 1 hr to fix

        Method upsert has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def upsert
            categories_params = params[:categories] || []
            every_category_has_migration_identifier = categories_params.all? { |category_params|
              category_params[:migration_identifier].present?
            }

          Method upsert has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def upsert
              organizations_params = params[:organizations] || []
              every_organization_has_migration_identifier = organizations_params.all? { |organization_params|
                organization_params[:migration_identifier].present?
              }
          Severity: Minor
          Found in app/controllers/api/osuny/university/organizations_controller.rb - About 1 hr to fix

            Method upsert has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def upsert
                pages_params = params[:pages] || []
                every_page_has_migration_identifier = pages_params.all? { |page_params|
                  page_params[:migration_identifier].present?
                }

              Method upsert has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def upsert
                  posts_params = params[:posts] || []
                  every_post_has_migration_identifier = posts_params.all? { |post_params|
                    post_params[:migration_identifier].present?
                  }

                Method upsert has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def upsert
                    events_params = params[:events] || []
                    every_event_has_migration_identifier = events_params.all? { |event_params|
                      event_params[:migration_identifier].present?
                    }

                  Method upsert has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def upsert
                      categories_params = params[:categories] || []
                      every_category_has_migration_identifier = categories_params.all? { |category_params|
                        category_params[:migration_identifier].present?
                      }

                    Method set_featured_image_to_l10n_params has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def set_featured_image_to_l10n_params(l10n_params, l10n: nil)
                        featured_image_data = l10n_params.delete(:featured_image)
                        return unless featured_image_data.present?
                        l10n_params[:featured_image_alt] = featured_image_data[:alt] if featured_image_data.has_key?(:alt)
                        l10n_params[:featured_image_credit] = featured_image_data[:credit] if featured_image_data.has_key?(:credit)

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

                        def build_person
                          if @email.present?
                            person = find_person_with_email
                          elsif @first_name.present? && @last_name.present?
                            person = find_person_with_name_in_current_language
                    Severity: Minor
                    Found in app/services/importers/hash_to_person.rb - About 1 hr to fix

                      Method organization has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def organization
                            unless @organization
                              if @siren.present? && @nic.present?
                                @organization = find_organization_with_siren_and_nic
                              elsif @siren.present?
                      Severity: Minor
                      Found in app/services/importers/hash_to_organization.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language