lespoupeesrusses/promethee

View on GitHub

Showing 13 of 22 total issues

Method upgraded_attributes has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def upgraded_attributes
      {
        'size' => {
          'searchable' => false,
          'translatable' => false,
Severity: Major
Found in app/services/promethee/structure_upgrader/components/column.rb - About 2 hrs to fix

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

      def promethee_sanitize_attributes(attributes)
        attributes.each do |key, value_object|
          case value_object['type']
          when 'string'
            while value_object['value'] != Loofah.fragment(value_object['value']).text(encode_special_chars: false)
    Severity: Minor
    Found in app/models/concerns/promethee_data.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 upgraded_backgrounds has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def upgraded_backgrounds(backgrounds)
          backgrounds ||= []
          backgrounds.map { |background|
            {
              'image' => {
    Severity: Minor
    Found in app/services/promethee/structure_upgrader/components/row.rb - About 1 hr to fix

      Method upgraded_attributes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def upgraded_attributes
            {
              'title' => {
                'searchable' => true,
                'translatable' => true,
      Severity: Minor
      Found in app/services/promethee/structure_upgrader/components/page.rb - About 1 hr to fix

        Method upgraded_attributes has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def upgraded_attributes
              {
                'visible_content' => {
                  'searchable' => true,
                  'translatable' => true,
        Severity: Minor
        Found in app/services/promethee/structure_upgrader/components/aside.rb - About 1 hr to fix

          Method upgraded_attributes has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def upgraded_attributes
                {
                  'caption' => {
                    'searchable' => true,
                    'translatable' => true,

            Method upgraded_attributes has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def upgraded_attributes
                  {
                    'caption' => {
                      'searchable' => true,
                      'translatable' => true,
            Severity: Minor
            Found in app/services/promethee/structure_upgrader/components/slider_item.rb - About 1 hr to fix

              Method upgraded_attributes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def upgraded_attributes
                    {
                      'image' => {
                        'searchable' => false,
                        'translatable' => false,
              Severity: Minor
              Found in app/services/promethee/structure_upgrader/components/faq_item.rb - About 1 hr to fix

                Method upgraded_attributes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def upgraded_attributes
                      {
                        'image' => {
                          'searchable' => false,
                          'translatable' => false,
                Severity: Minor
                Found in app/services/promethee/structure_upgrader/components/cover.rb - About 1 hr to fix

                  Method promethee_extract_searchable_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def promethee_extract_searchable_attributes(attributes)
                      searchable = ' '
                      attributes.each do |key, value_object|
                        if value_object['searchable']
                          clean_value = strip_tags value_object['value']
                  Severity: Minor
                  Found in app/models/concerns/promethee_data.rb - About 35 mins 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 blob_show has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def blob_show
                      # as this is called only from promethee preview it sends an image resized to 720
                      begin
                        blob_find_method = ActiveStorage::Blob.respond_to?(:find_signed!) ? :find_signed! : :find_signed
                        blob = ActiveStorage::Blob.public_send(blob_find_method, params[:id])
                  Severity: Minor
                  Found in app/controllers/promethee_controller.rb - About 35 mins 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 blob_from_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def blob_from_data(blob_data = {})
                      return unless blob_data&.has_key? :id
                      blob_find_method = ActiveStorage::Blob.respond_to?(:find_signed!) ? :find_signed! : :find_signed
                      ActiveStorage::Blob.public_send blob_find_method, blob_data[:id]
                    rescue
                  Severity: Minor
                  Found in lib/promethee/rails/helper.rb - About 35 mins 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 upgrade_attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def upgrade_attribute(attribute_value)
                        return upgrade_blob_data(attribute_value) if is_blob_data?(attribute_value)
                  
                        if attribute_value.is_a? Array
                          attribute_value.map { |item| upgrade_attribute(item) }
                  Severity: Minor
                  Found in app/services/promethee/blob_upgrade_service.rb - About 25 mins 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

                  Severity
                  Category
                  Status
                  Source
                  Language