ikuseiGmbH/Goldencobra

View on GitHub
app/helpers/goldencobra/navigation_helper.rb

Summary

Maintainability
D
1 day
Test Coverage

Assignment Branch Condition size for navigation_menu is too high. [108.5/15]
Open

    def navigation_menu(menue_id, options={})
      return "id can't be blank" if menue_id.blank?
      depth = options[:depth] || 9999
      offset = options[:offset] || 0
      class_name = options[:class] || ""

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Complex method Goldencobra::NavigationHelper#navigation_menu (165.9)
Open

    def navigation_menu(menue_id, options={})
      return "id can't be blank" if menue_id.blank?
      depth = options[:depth] || 9999
      offset = options[:offset] || 0
      class_name = options[:class] || ""

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Module has too many lines. [127/100]
Open

  module NavigationHelper
    def breadcrumb(options={})
      id_name = options["id"] || "breadcrumb"
      class_name = options["class"] || ""
      if @article

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for navigation_menu_helper is too high. [75.44/15]
Open

    def navigation_menu_helper(child, options, subtree_menues, current_depth)
      if @current_client && @current_client.url_prefix.present?
        child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')
      else
        child_target_link = child.target.gsub("\"",'')

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [64/10]
Open

    def navigation_menu(menue_id, options={})
      return "id can't be blank" if menue_id.blank?
      depth = options[:depth] || 9999
      offset = options[:offset] || 0
      class_name = options[:class] || ""

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Complex method Goldencobra::NavigationHelper#navigation_menu_helper (102.6)
Open

    def navigation_menu_helper(child, options, subtree_menues, current_depth)
      if @current_client && @current_client.url_prefix.present?
        child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')
      else
        child_target_link = child.target.gsub("\"",'')

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Method navigation_menu_helper has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def navigation_menu_helper(child, options, subtree_menues, current_depth)
      if @current_client && @current_client.url_prefix.present?
        child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')
      else
        child_target_link = child.target.gsub("\"",'')
Severity: Minor
Found in app/helpers/goldencobra/navigation_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

Perceived complexity for navigation_menu is too high. [31/7]
Open

    def navigation_menu(menue_id, options={})
      return "id can't be blank" if menue_id.blank?
      depth = options[:depth] || 9999
      offset = options[:offset] || 0
      class_name = options[:class] || ""

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Method has too many lines. [33/10]
Open

    def navigation_menu_helper(child, options, subtree_menues, current_depth)
      if @current_client && @current_client.url_prefix.present?
        child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')
      else
        child_target_link = child.target.gsub("\"",'')

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for navigation_menu is too high. [26/6]
Open

    def navigation_menu(menue_id, options={})
      return "id can't be blank" if menue_id.blank?
      depth = options[:depth] || 9999
      offset = options[:offset] || 0
      class_name = options[:class] || ""

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method navigation_menu has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def navigation_menu(menue_id, options={})
      return "id can't be blank" if menue_id.blank?
      depth = options[:depth] || 9999
      offset = options[:offset] || 0
      class_name = options[:class] || ""
Severity: Minor
Found in app/helpers/goldencobra/navigation_helper.rb - About 3 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

Perceived complexity for navigation_menu_helper is too high. [20/7]
Open

    def navigation_menu_helper(child, options, subtree_menues, current_depth)
      if @current_client && @current_client.url_prefix.present?
        child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')
      else
        child_target_link = child.target.gsub("\"",'')

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Cyclomatic complexity for navigation_menu_helper is too high. [18/6]
Open

    def navigation_menu_helper(child, options, subtree_menues, current_depth)
      if @current_client && @current_client.url_prefix.present?
        child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')
      else
        child_target_link = child.target.gsub("\"",'')

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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

    def navigation_menu(menue_id, options={})
      return "id can't be blank" if menue_id.blank?
      depth = options[:depth] || 9999
      offset = options[:offset] || 0
      class_name = options[:class] || ""
Severity: Major
Found in app/helpers/goldencobra/navigation_helper.rb - About 2 hrs to fix

    Method has too many lines. [16/10]
    Open

        def breadcrumb(options={})
          id_name = options["id"] || "breadcrumb"
          class_name = options["class"] || ""
          if @article
            list = ""

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for breadcrumb is too high. [19.72/15]
    Open

        def breadcrumb(options={})
          id_name = options["id"] || "breadcrumb"
          class_name = options["class"] || ""
          if @article
            list = ""

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

        def navigation_menu_helper(child, options, subtree_menues, current_depth)
          if @current_client && @current_client.url_prefix.present?
            child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')
          else
            child_target_link = child.target.gsub("\"",'')
    Severity: Minor
    Found in app/helpers/goldencobra/navigation_helper.rb - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if params.present? && params[:frontend_tags].present? && params[:frontend_tags].class != String && params[:frontend_tags][:format] && params[:frontend_tags][:format] == "email"
                #Wenn format email, dann gibt es keinen realen webseit besucher
                ability = Ability.new()
              else current_user.present? || current_visitor.present?
                operator = current_user || current_visitor
      Severity: Major
      Found in app/helpers/goldencobra/navigation_helper.rb - About 1 hr to fix

        Complex method Goldencobra::NavigationHelper#breadcrumb (27.1)
        Open

            def breadcrumb(options={})
              id_name = options["id"] || "breadcrumb"
              class_name = options["class"] || ""
              if @article
                list = ""

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Goldencobra::NavigationHelper#breadcrumb has approx 10 statements
        Open

            def breadcrumb(options={})

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::NavigationHelper#navigation_menu_helper has approx 24 statements
        Open

            def navigation_menu_helper(child, options, subtree_menues, current_depth)

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::NavigationHelper#navigation_menu has approx 35 statements
        Open

            def navigation_menu(menue_id, options={})

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::NavigationHelper#navigation_menu_helper has 4 parameters
        Open

            def navigation_menu_helper(child, options, subtree_menues, current_depth)

        A Long Parameter List occurs when a method has a lot of parameters.

        Example

        Given

        class Dummy
          def long_list(foo,bar,baz,fling,flung)
            puts foo,bar,baz,fling,flung
          end
        end

        Reek would report the following warning:

        test.rb -- 1 warning:
          [2]:Dummy#long_list has 5 parameters (LongParameterList)

        A common solution to this problem would be the introduction of parameter objects.

        Goldencobra::NavigationHelper#navigation_menu calls 'a.path' 2 times
        Open

                  current_menue = Goldencobra::Menue.active.where(target: current_article.public_url(false)).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first
                  if current_menue
                    master_menue = Goldencobra::Menue.find_by_id(current_menue.path_ids[offset])
                  else
                    return ""

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu_helper calls 'child.target.gsub("\"",'')' 2 times
        Open

                child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')
              else
                child_target_link = child.target.gsub("\"",'')

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu_helper calls 'request.present?' 2 times
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#menue_roots calls 'a.ancestry.to_s' 2 times
        Open

              min_of_layers = menue_array.map{|a| a.ancestry.to_s.split("/").count }.min
              menue_array.select{|a| a.ancestry.to_s.split("/").count == min_of_layers }

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu calls 'current_depth + depth' 2 times
        Open

                                             .to_depth(current_depth + depth)
                                             .active.includes(:permissions).includes(:image)
              else
                subtree_menues = master_menue.subtree.after_depth(current_depth + offset)
                                             .to_depth(current_depth + depth)

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu calls 'a.path.map(&:title)' 2 times
        Open

                  current_menue = Goldencobra::Menue.active.where(target: current_article.public_url(false)).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first
                  if current_menue
                    master_menue = Goldencobra::Menue.find_by_id(current_menue.path_ids[offset])
                  else
                    return ""

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu calls 'current_article.present?' 2 times
        Open

                if current_article.present? && current_article.public_url.present?
                  current_menue = Goldencobra::Menue.active.where(target: current_article.public_url(false)).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first
                  if current_menue
                    master_menue = Goldencobra::Menue.find_by_id(current_menue.path_ids[offset])
                  else

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu_helper calls '@current_client.url_prefix' 2 times
        Open

              if @current_client && @current_client.url_prefix.present?
                child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu_helper calls 'child.target' 2 times
        Open

                child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')
              else
                child_target_link = child.target.gsub("\"",'')

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu_helper calls 'subchild.css_class' 2 times
        Open

                  if subchild.css_class != "hidden" && subchild.css_class != "not_visible"

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu_helper calls 'child.image' 2 times
        Open

              image_link = child.image.present? ? image_tag(child.image.image(:original)) : ""

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper has no descriptive comment
        Open

          module NavigationHelper

        Classes and modules are the units of reuse and release. It is therefore considered good practice to annotate every class and module with a brief comment outlining its responsibilities.

        Example

        Given

        class Dummy
          # Do things...
        end

        Reek would emit the following warning:

        test.rb -- 1 warning:
          [1]:Dummy has no descriptive comment (IrresponsibleModule)

        Fixing this is simple - just an explaining comment:

        # The Dummy class is responsible for ...
        class Dummy
          # Do things...
        end

        Goldencobra::NavigationHelper#menue_roots calls 'a.ancestry.to_s.split("/")' 2 times
        Open

              min_of_layers = menue_array.map{|a| a.ancestry.to_s.split("/").count }.min
              menue_array.select{|a| a.ancestry.to_s.split("/").count == min_of_layers }

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#breadcrumb calls 'raw(content_list)' 2 times
        Open

                  result = content_tag(:nav, raw(content_list), id: "#{id_name}", class: "#{class_name}")
                else
                  result = content_tag(:nav, raw(content_list), class: "#{class_name}")

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#menue_roots calls 'a.ancestry' 2 times
        Open

              min_of_layers = menue_array.map{|a| a.ancestry.to_s.split("/").count }.min
              menue_array.select{|a| a.ancestry.to_s.split("/").count == min_of_layers }

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#menue_roots calls 'a.ancestry.to_s.split("/").count' 2 times
        Open

              min_of_layers = menue_array.map{|a| a.ancestry.to_s.split("/").count }.min
              menue_array.select{|a| a.ancestry.to_s.split("/").count == min_of_layers }

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu calls 'Goldencobra::Menue.active' 4 times
        Open

                  current_menue = Goldencobra::Menue.active.where(target: current_article.public_url(false)).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first
                  if current_menue
                    master_menue = Goldencobra::Menue.find_by_id(current_menue.path_ids[offset])
                  else
                    return ""

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu calls 'a.path.map(&:title).join("/").include?(menue_id)' 2 times
        Open

                  current_menue = Goldencobra::Menue.active.where(target: current_article.public_url(false)).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first
                  if current_menue
                    master_menue = Goldencobra::Menue.find_by_id(current_menue.path_ids[offset])
                  else
                    return ""

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu calls 'params[:frontend_tags]' 4 times
        Open

                if params.present? && params[:frontend_tags].present? && params[:frontend_tags].class != String && params[:frontend_tags][:format] && params[:frontend_tags][:format] == "email"

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu calls 'a.path.map(&:title).join("/")' 2 times
        Open

                  current_menue = Goldencobra::Menue.active.where(target: current_article.public_url(false)).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first
                  if current_menue
                    master_menue = Goldencobra::Menue.find_by_id(current_menue.path_ids[offset])
                  else
                    return ""

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu calls 'master_menue.subtree' 2 times
        Open

                subtree_menues = master_menue.subtree.after_depth(current_depth)
                                             .to_depth(current_depth + depth)
                                             .active.includes(:permissions).includes(:image)
              else
                subtree_menues = master_menue.subtree.after_depth(current_depth + offset)

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu calls 'params[:frontend_tags][:format]' 2 times
        Open

                if params.present? && params[:frontend_tags].present? && params[:frontend_tags].class != String && params[:frontend_tags][:format] && params[:frontend_tags][:format] == "email"

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::NavigationHelper#navigation_menu calls 'submenue_of_article.public_url' 2 times
        Open

                elsif submenue_of_article.present? && submenue_of_article.public_url.present?
                  master_menue = Goldencobra::Menue.active.where(target: submenue_of_article.public_url).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Method breadcrumb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def breadcrumb(options={})
              id_name = options["id"] || "breadcrumb"
              class_name = options["class"] || ""
              if @article
                list = ""
        Severity: Minor
        Found in app/helpers/goldencobra/navigation_helper.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

        Goldencobra::NavigationHelper#menue_children doesn't depend on instance state (maybe move it to another class?)
        Open

            def menue_children(menue_element, menue_array)

        A Utility Function is any instance method that has no dependency on the state of the instance.

        Goldencobra::NavigationHelper#menue_roots doesn't depend on instance state (maybe move it to another class?)
        Open

            def menue_roots(menue_array)

        A Utility Function is any instance method that has no dependency on the state of the instance.

        Goldencobra::NavigationHelper#menue_roots has the variable name 'a'
        Open

              min_of_layers = menue_array.map{|a| a.ancestry.to_s.split("/").count }.min
              menue_array.select{|a| a.ancestry.to_s.split("/").count == min_of_layers }

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::NavigationHelper#menue_children has the variable name 'a'
        Open

              menue_array.select{|a| a.ancestry.to_s.split("/").last.to_i == menue_element.id }

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::NavigationHelper#navigation_menu has the variable name 'a'
        Open

                  current_menue = Goldencobra::Menue.active.where(target: current_article.public_url(false)).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first
                  if current_menue
                    master_menue = Goldencobra::Menue.find_by_id(current_menue.path_ids[offset])
                  else
                    return ""

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Use delete instead of gsub.
        Open

                child_target_link = child.target.gsub("\"",'')

        This cop identifies places where gsub can be replaced by tr or delete.

        Example:

        # bad
        'abc'.gsub('b', 'd')
        'abc'.gsub('a', '')
        'abc'.gsub(/a/, 'd')
        'abc'.gsub!('a', 'd')
        
        # good
        'abc'.gsub(/.*/, 'a')
        'abc'.gsub(/a+/, 'd')
        'abc'.tr('b', 'd')
        'a b c'.delete(' ')

        Use delete instead of gsub.
        Open

                child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')

        This cop identifies places where gsub can be replaced by tr or delete.

        Example:

        # bad
        'abc'.gsub('b', 'd')
        'abc'.gsub('a', '')
        'abc'.gsub(/a/, 'd')
        'abc'.gsub!('a', 'd')
        
        # good
        'abc'.gsub(/.*/, 'a')
        'abc'.gsub(/a+/, 'd')
        'abc'.tr('b', 'd')
        'a b c'.delete(' ')

        TODO found
        Open

            # TODO: offset implementieren

        TODO found
        Open

            # TODO: refactor method to make it easier to test

        Extra empty line detected at module body end.
        Open

        
          end

        This cops checks if empty lines around the bodies of modules match the configuration.

        Example: EnforcedStyle: empty_lines

        # good
        
        module Foo
        
          def bar
            # ...
          end
        
        end

        Example: EnforcedStyle: emptylinesexcept_namespace

        # good
        
        module Foo
          module Bar
        
            # ...
        
          end
        end

        Example: EnforcedStyle: emptylinesspecial

        # good
        module Foo
        
          def bar; end
        
        end

        Example: EnforcedStyle: noemptylines (default)

        # good
        
        module Foo
          def bar
            # ...
          end
        end

        Missing space after #.
        Open

                  #Wenn format email, dann gibt es keinen realen webseit besucher

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Space missing to the left of {.
        Open

              menue_array.select{|a| a.ancestry.to_s.split("/").last.to_i == menue_element.id }

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space inside { missing.
        Open

                link_options = {"data-remote" => "true",href: child_target_link}

        Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that hash literals have
        # surrounding space.
        
        # bad
        h = {a: 1, b: 2}
        
        # good
        h = { a: 1, b: 2 }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that hash literals have
        # no surrounding space.
        
        # bad
        h = { a: 1, b: 2 }
        
        # good
        h = {a: 1, b: 2}

        Example: EnforcedStyle: compact

        # The `compact` style normally requires a space inside
        # hash braces, with the exception that successive left
        # braces or right braces are collapsed together in nested hashes.
        
        # bad
        h = { a: { b: 2 } }
        
        # good
        h = { a: { b: 2 }}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces do not contain spaces.
        
        # bad
        foo = { }
        bar = {    }
        
        # good
        foo = {}
        bar = {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces contain space.
        
        # bad
        foo = {}
        
        # good
        foo = { }
        foo = {  }
        foo = {     }

        Line is too long. [163/100]
        Open

                  master_menue = Goldencobra::Menue.active.where(target: submenue_of_article.public_url).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [184/100]
        Open

              child_link = child_link + content_tag(:a, child.description_title, link_options.merge(class: "navigtion_link_description_title")) unless options[:show_description_title] == false

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use self-assignment shorthand +=.
        Open

              child_link = child_link + content_tag("div", raw(template.render(Goldencobra::Article::LiquidParser)), class: "navigtion_link_description") unless options[:show_description] == false

        This cop enforces the use the shorthand for self-assignment.

        Example:

        # bad
        x = x + 1
        
        # good
        x += 1

        Inconsistent indentation detected.
        Open

                  operator = current_user || current_visitor

        This cops checks for inconsistent indentation.

        The difference between rails and normal is that the rails style prescribes that in classes and modules the protected and private modifier keywords shall be indented the same as public methods and that protected and private members shall be indented one step more than the modifiers. Other than that, both styles mean that entities on the same logical depth shall have the same indentation.

        Example: EnforcedStyle: normal (default)

        # bad
        class A
          def test
            puts 'hello'
             puts 'world'
          end
        end
        
        # bad
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        
          protected
        
            def foo
            end
        
          private
        
            def bar
            end
        end
        
        # good
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        end
        
        # good
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        
          protected
        
          def foo
          end
        
          private
        
          def bar
          end
        end

        Example: EnforcedStyle: rails

        # bad
        class A
          def test
            puts 'hello'
             puts 'world'
          end
        end
        
        # bad
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        
          protected
        
          def foo
          end
        
          private
        
          def bar
          end
        end
        
        # good
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        end
        
        # good
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        
          protected
        
            def foo
            end
        
          private
        
            def bar
            end
        end

        Indent .active 2 spaces more than master_menue on line 80.
        Open

                                             .active.includes(:permissions).includes(:image)

        This cop checks the indentation of the method name part in method calls that span more than one line.

        Example: EnforcedStyle: aligned (default)

        # bad
        while myvariable
        .b
          # do something
        end
        
        # good
        while myvariable
              .b
          # do something
        end
        
        # good
        Thing.a
             .b
             .c

        Example: EnforcedStyle: indented

        # good
        while myvariable
          .b
        
          # do something
        end

        Example: EnforcedStyle: indentedrelativeto_receiver

        # good
        while myvariable
                .a
                .b
        
          # do something
        end
        
        # good
        myvariable = Thing
                       .a
                       .b
                       .c

        Space inside string interpolation detected.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks for whitespace within string interpolations.

        Example: EnforcedStyle: no_space (default)

        # bad
           var = "This is the #{ space } example"
        
        # good
           var = "This is the #{no_space} example"

        Example: EnforcedStyle: space

        # bad
           var = "This is the #{no_space} example"
        
        # good
           var = "This is the #{ space } example"

        Space inside string interpolation detected.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks for whitespace within string interpolations.

        Example: EnforcedStyle: no_space (default)

        # bad
           var = "This is the #{ space } example"
        
        # good
           var = "This is the #{no_space} example"

        Example: EnforcedStyle: space

        # bad
           var = "This is the #{no_space} example"
        
        # good
           var = "This is the #{ space } example"

        Line is too long. [184/100]
        Open

                if params.present? && params[:frontend_tags].present? && params[:frontend_tags].class != String && params[:frontend_tags][:format] && params[:frontend_tags][:format] == "email"

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [146/100]
        Open

                  child_link = child_link + content_tag(:ul, raw(content_level), class: "level_#{current_depth} children_#{visible_child_element_count}" )

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use self-assignment shorthand +=.
        Open

              child_link = child_link + content_tag(:a, image_link, link_options.merge(class: "navigtion_link_imgage_wrapper")) unless options[:show_image] == false

        This cop enforces the use the shorthand for self-assignment.

        Example:

        # bad
        x = x + 1
        
        # good
        x += 1

        Space missing to the left of {.
        Open

              min_of_layers = menue_array.map{|a| a.ancestry.to_s.split("/").count }.min

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space between { and | missing.
        Open

                  master_menue = Goldencobra::Menue.active.where(target: submenue_of_article.public_url).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space inside parentheses detected.
        Open

              child_link = content_tag(:a, child.title, link_options )

        Checks for spaces inside ordinary round parentheses.

        Example: EnforcedStyle: no_space (default)

        # The `no_space` style enforces that parentheses do not have spaces.
        
        # bad
        f( 3)
        g = (a + 3 )
        
        # good
        f(3)
        g = (a + 3)

        Example: EnforcedStyle: space

        # The `space` style enforces that parentheses have a space at the
        # beginning and end.
        # Note: Empty parentheses should not have spaces.
        
        # bad
        f(3)
        g = (a + 3)
        y( )
        
        # good
        f( 3 )
        g = ( a + 3 )
        y()

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Prefer double-quoted strings inside interpolations.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks that quotes inside the string interpolation match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        result = "Tests #{success ? "PASS" : "FAIL"}"
        
        # good
        result = "Tests #{success ? 'PASS' : 'FAIL'}"

        Example: EnforcedStyle: double_quotes

        # bad
        result = "Tests #{success ? 'PASS' : 'FAIL'}"
        
        # good
        result = "Tests #{success ? "PASS" : "FAIL"}"

        Indent .active 2 spaces more than master_menue on line 76.
        Open

                                             .active.includes(:permissions).includes(:image)

        This cop checks the indentation of the method name part in method calls that span more than one line.

        Example: EnforcedStyle: aligned (default)

        # bad
        while myvariable
        .b
          # do something
        end
        
        # good
        while myvariable
              .b
          # do something
        end
        
        # good
        Thing.a
             .b
             .c

        Example: EnforcedStyle: indented

        # good
        while myvariable
          .b
        
          # do something
        end

        Example: EnforcedStyle: indentedrelativeto_receiver

        # good
        while myvariable
                .a
                .b
        
          # do something
        end
        
        # good
        myvariable = Thing
                       .a
                       .b
                       .c

        Odd else layout detected. Did you mean to use elsif?
        Open

                else current_user.present? || current_visitor.present?

        This cop checks for odd else block layout - like having an expression on the same line as the else keyword, which is usually a mistake.

        Example:

        # bad
        
        if something
          # ...
        else do_this
          do_that
        end

        Example:

        # good
        
        if something
          # ...
        else
          do_this
          do_that
        end

        Prefer double-quoted strings inside interpolations.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks that quotes inside the string interpolation match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        result = "Tests #{success ? "PASS" : "FAIL"}"
        
        # good
        result = "Tests #{success ? 'PASS' : 'FAIL'}"

        Example: EnforcedStyle: double_quotes

        # bad
        result = "Tests #{success ? 'PASS' : 'FAIL'}"
        
        # good
        result = "Tests #{success ? "PASS" : "FAIL"}"

        Missing space after #.
        Open

            #<%= navigation_menu("Top-Menu", current_article: @article, class: "ul_main_nav", depth: 1, offset: 1 %>

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Space missing after comma.
        Open

                link_options = {"data-remote" => "true",href: child_target_link}

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Do not use parentheses for method calls with no arguments.
        Open

                ability = Ability.new()

        This cop checks for unwanted parentheses in parameterless method calls.

        Example:

        # bad
        object.some_method()
        
        # good
        object.some_method

        Redundant return detected.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

                child_target_link = child.target.gsub("\"",'')

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Space missing after comma.
        Open

                child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Space missing to the left of {.
        Open

              subtree_menues = subtree_menues.to_a.delete_if{|a| !ability.can?(:read, a)}

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Line is too long. [190/100]
        Open

              child_link = child_link + content_tag(:a, child.call_to_action_name, link_options.merge(class: "navigtion_link_call_to_action_name")) unless options[:show_call_to_action_name] == false

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use the return of the conditional for variable assignment and comparison.
        Open

              if child.remote
                link_options = {"data-remote" => "true",href: child_target_link}
              else
                link_options = {href: child_target_link}
              end

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if @article

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Use self-assignment shorthand +=.
        Open

              child_link = child_link + content_tag(:a, child.call_to_action_name, link_options.merge(class: "navigtion_link_call_to_action_name")) unless options[:show_call_to_action_name] == false

        This cop enforces the use the shorthand for self-assignment.

        Example:

        # bad
        x = x + 1
        
        # good
        x += 1

        Prefer double-quoted strings inside interpolations.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks that quotes inside the string interpolation match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        result = "Tests #{success ? "PASS" : "FAIL"}"
        
        # good
        result = "Tests #{success ? 'PASS' : 'FAIL'}"

        Example: EnforcedStyle: double_quotes

        # bad
        result = "Tests #{success ? 'PASS' : 'FAIL'}"
        
        # good
        result = "Tests #{success ? "PASS" : "FAIL"}"

        Prefer double-quoted strings inside interpolations.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks that quotes inside the string interpolation match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        result = "Tests #{success ? "PASS" : "FAIL"}"
        
        # good
        result = "Tests #{success ? 'PASS' : 'FAIL'}"

        Example: EnforcedStyle: double_quotes

        # bad
        result = "Tests #{success ? 'PASS' : 'FAIL'}"
        
        # good
        result = "Tests #{success ? "PASS" : "FAIL"}"

        Inconsistent indentation detected.
        Open

                  ability = Ability.new(operator)

        This cops checks for inconsistent indentation.

        The difference between rails and normal is that the rails style prescribes that in classes and modules the protected and private modifier keywords shall be indented the same as public methods and that protected and private members shall be indented one step more than the modifiers. Other than that, both styles mean that entities on the same logical depth shall have the same indentation.

        Example: EnforcedStyle: normal (default)

        # bad
        class A
          def test
            puts 'hello'
             puts 'world'
          end
        end
        
        # bad
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        
          protected
        
            def foo
            end
        
          private
        
            def bar
            end
        end
        
        # good
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        end
        
        # good
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        
          protected
        
          def foo
          end
        
          private
        
          def bar
          end
        end

        Example: EnforcedStyle: rails

        # bad
        class A
          def test
            puts 'hello'
             puts 'world'
          end
        end
        
        # bad
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        
          protected
        
          def foo
          end
        
          private
        
          def bar
          end
        end
        
        # good
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        end
        
        # good
        class A
          def test
            puts 'hello'
            puts 'world'
          end
        
          protected
        
            def foo
            end
        
          private
        
            def bar
            end
        end

        Indent .to_depth 2 spaces more than master_menue on line 80.
        Open

                                             .to_depth(current_depth + depth)

        This cop checks the indentation of the method name part in method calls that span more than one line.

        Example: EnforcedStyle: aligned (default)

        # bad
        while myvariable
        .b
          # do something
        end
        
        # good
        while myvariable
              .b
          # do something
        end
        
        # good
        Thing.a
             .b
             .c

        Example: EnforcedStyle: indented

        # good
        while myvariable
          .b
        
          # do something
        end

        Example: EnforcedStyle: indentedrelativeto_receiver

        # good
        while myvariable
                .a
                .b
        
          # do something
        end
        
        # good
        myvariable = Thing
                       .a
                       .b
                       .c

        Space missing to the left of {.
        Open

                  master_menue = Goldencobra::Menue.active.where(target: submenue_of_article.public_url).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space missing inside }.
        Open

              subtree_menues = subtree_menues.to_a.delete_if{|a| !ability.can?(:read, a)}

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space inside string interpolation detected.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks for whitespace within string interpolations.

        Example: EnforcedStyle: no_space (default)

        # bad
           var = "This is the #{ space } example"
        
        # good
           var = "This is the #{no_space} example"

        Example: EnforcedStyle: space

        # bad
           var = "This is the #{no_space} example"
        
        # good
           var = "This is the #{ space } example"

        Use the return of the conditional for variable assignment and comparison.
        Open

              if @current_client && @current_client.url_prefix.present?
                child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')
              else
                child_target_link = child.target.gsub("\"",'')
              end

        Space missing to the left of {.
        Open

                  current_menue = Goldencobra::Menue.active.where(target: current_article.public_url(false)).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space inside string interpolation detected.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks for whitespace within string interpolations.

        Example: EnforcedStyle: no_space (default)

        # bad
           var = "This is the #{ space } example"
        
        # good
           var = "This is the #{no_space} example"

        Example: EnforcedStyle: space

        # bad
           var = "This is the #{no_space} example"
        
        # good
           var = "This is the #{ space } example"

        Do not use parentheses for method calls with no arguments.
        Open

                  ability = Ability.new()

        This cop checks for unwanted parentheses in parameterless method calls.

        Example:

        # bad
        object.some_method()
        
        # good
        object.some_method

        Use self-assignment shorthand +=.
        Open

              child_link = child_link + content_tag(:a, child.description_title, link_options.merge(class: "navigtion_link_description_title")) unless options[:show_description_title] == false

        This cop enforces the use the shorthand for self-assignment.

        Example:

        # bad
        x = x + 1
        
        # good
        x += 1

        Use self-assignment shorthand +=.
        Open

                  child_link = child_link + content_tag(:ul, raw(content_level), class: "level_#{current_depth} children_#{visible_child_element_count}" )

        This cop enforces the use the shorthand for self-assignment.

        Example:

        # bad
        x = x + 1
        
        # good
        x += 1

        Use 2 (not 0) spaces for rails indentation.
        Open

            def menue_roots(menue_array)

        This cops checks for indentation that doesn't use the specified number of spaces.

        See also the IndentationConsistency cop which is the companion to this one.

        Example:

        # bad
        class A
         def test
          puts 'hello'
         end
        end
        
        # good
        class A
          def test
            puts 'hello'
          end
        end

        Example: IgnoredPatterns: ['^\s*module']

        # bad
        module A
        class B
          def test
          puts 'hello'
          end
        end
        end
        
        # good
        module A
        class B
          def test
            puts 'hello'
          end
        end
        end

        Space between { and | missing.
        Open

                  current_menue = Goldencobra::Menue.active.where(target: current_article.public_url(false)).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space missing inside }.
        Open

                  master_menue = Goldencobra::Menue.active.where(target: submenue_of_article.public_url).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Line is too long. [107/100]
        Open

            # depth: 0 = unlimited, 1 = self, 2 = self and children 1. grades, 3 = self and up to children 2.grades

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [108/100]
        Open

            #<%= navigation_menu("Top-Menu", current_article: @article, class: "ul_main_nav", depth: 1, offset: 1 %>

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [156/100]
        Open

              child_link = child_link + content_tag(:a, image_link, link_options.merge(class: "navigtion_link_imgage_wrapper")) unless options[:show_image] == false

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [188/100]
        Open

              child_link = child_link + content_tag("div", raw(template.render(Goldencobra::Article::LiquidParser)), class: "navigtion_link_description") unless options[:show_description] == false

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [364/100]
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Missing top-level module documentation comment.
        Open

          module NavigationHelper

        This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

        The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

        Example:

        # bad
        class Person
          # ...
        end
        
        # good
        # Description/Explanation of Person class
        class Person
          # ...
        end

        Prefer to_s over string interpolation.
        Open

                  result = content_tag(:nav, raw(content_list), class: "#{class_name}")

        This cop checks for strings that are just an interpolated expression.

        Example:

        # bad
        "#{@var}"
        
        # good
        @var.to_s
        
        # good if @var is already a String
        @var

        Prefer to_s over string interpolation.
        Open

                  result = content_tag(:nav, raw(content_list), id: "#{id_name}", class: "#{class_name}")

        This cop checks for strings that are just an interpolated expression.

        Example:

        # bad
        "#{@var}"
        
        # good
        @var.to_s
        
        # good if @var is already a String
        @var

        Space missing inside }.
        Open

                  current_menue = Goldencobra::Menue.active.where(target: current_article.public_url(false)).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space between { and | missing.
        Open

              menue_array.select{|a| a.ancestry.to_s.split("/").count == min_of_layers }

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space between { and | missing.
        Open

              menue_array.select{|a| a.ancestry.to_s.split("/").last.to_i == menue_element.id }

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space inside { missing.
        Open

                link_options = {href: child_target_link}

        Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that hash literals have
        # surrounding space.
        
        # bad
        h = {a: 1, b: 2}
        
        # good
        h = { a: 1, b: 2 }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that hash literals have
        # no surrounding space.
        
        # bad
        h = { a: 1, b: 2 }
        
        # good
        h = {a: 1, b: 2}

        Example: EnforcedStyle: compact

        # The `compact` style normally requires a space inside
        # hash braces, with the exception that successive left
        # braces or right braces are collapsed together in nested hashes.
        
        # bad
        h = { a: { b: 2 } }
        
        # good
        h = { a: { b: 2 }}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces do not contain spaces.
        
        # bad
        foo = { }
        bar = {    }
        
        # good
        foo = {}
        bar = {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces contain space.
        
        # bad
        foo = {}
        
        # good
        foo = { }
        foo = {  }
        foo = {     }

        Use the return of the conditional for variable assignment and comparison.
        Open

                if id_name.present?
                  result = content_tag(:nav, raw(content_list), id: "#{id_name}", class: "#{class_name}")
                else
                  result = content_tag(:nav, raw(content_list), class: "#{class_name}")
                end

        Avoid rescuing without specifying an error class.
        Open

              rescue

        This cop checks for rescuing StandardError. There are two supported styles implicit and explicit. This cop will not register an offense if any error other than StandardError is specified.

        Example: EnforcedStyle: implicit

        # `implicit` will enforce using `rescue` instead of
        # `rescue StandardError`.
        
        # bad
        begin
          foo
        rescue StandardError
          bar
        end
        
        # good
        begin
          foo
        rescue
          bar
        end
        
        # good
        begin
          foo
        rescue OtherError
          bar
        end
        
        # good
        begin
          foo
        rescue StandardError, SecurityError
          bar
        end

        Example: EnforcedStyle: explicit (default)

        # `explicit` will enforce using `rescue StandardError`
        # instead of `rescue`.
        
        # bad
        begin
          foo
        rescue
          bar
        end
        
        # good
        begin
          foo
        rescue StandardError
          bar
        end
        
        # good
        begin
          foo
        rescue OtherError
          bar
        end
        
        # good
        begin
          foo
        rescue StandardError, SecurityError
          bar
        end

        Indent .to_depth 2 spaces more than master_menue on line 76.
        Open

                                             .to_depth(current_depth + depth)

        This cop checks the indentation of the method name part in method calls that span more than one line.

        Example: EnforcedStyle: aligned (default)

        # bad
        while myvariable
        .b
          # do something
        end
        
        # good
        while myvariable
              .b
          # do something
        end
        
        # good
        Thing.a
             .b
             .c

        Example: EnforcedStyle: indented

        # good
        while myvariable
          .b
        
          # do something
        end

        Example: EnforcedStyle: indentedrelativeto_receiver

        # good
        while myvariable
                .a
                .b
        
          # do something
        end
        
        # good
        myvariable = Thing
                       .a
                       .b
                       .c

        Surrounding space missing in default value assignment.
        Open

            def breadcrumb(options={})

        Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end
        
        # good
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end

        Example: EnforcedStyle: no_space

        # bad
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end
        
        # good
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end

        Space missing to the left of {.
        Open

              menue_array.select{|a| a.ancestry.to_s.split("/").count == min_of_layers }

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

                child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Prefer to_s over string interpolation.
        Open

                  result = content_tag(:nav, raw(content_list), id: "#{id_name}", class: "#{class_name}")

        This cop checks for strings that are just an interpolated expression.

        Example:

        # bad
        "#{@var}"
        
        # good
        @var.to_s
        
        # good if @var is already a String
        @var

        Space missing after comma.
        Open

                child_target_link = child.target.gsub("\"",'')

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Space between { and | missing.
        Open

              subtree_menues = subtree_menues.to_a.delete_if{|a| !ability.can?(:read, a)}

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space inside } missing.
        Open

                link_options = {"data-remote" => "true",href: child_target_link}

        Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that hash literals have
        # surrounding space.
        
        # bad
        h = {a: 1, b: 2}
        
        # good
        h = { a: 1, b: 2 }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that hash literals have
        # no surrounding space.
        
        # bad
        h = { a: 1, b: 2 }
        
        # good
        h = {a: 1, b: 2}

        Example: EnforcedStyle: compact

        # The `compact` style normally requires a space inside
        # hash braces, with the exception that successive left
        # braces or right braces are collapsed together in nested hashes.
        
        # bad
        h = { a: { b: 2 } }
        
        # good
        h = { a: { b: 2 }}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces do not contain spaces.
        
        # bad
        foo = { }
        bar = {    }
        
        # good
        foo = {}
        bar = {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces contain space.
        
        # bad
        foo = {}
        
        # good
        foo = { }
        foo = {  }
        foo = {     }

        Space inside parentheses detected.
        Open

                  child_link = child_link + content_tag(:ul, raw(content_level), class: "level_#{current_depth} children_#{visible_child_element_count}" )

        Checks for spaces inside ordinary round parentheses.

        Example: EnforcedStyle: no_space (default)

        # The `no_space` style enforces that parentheses do not have spaces.
        
        # bad
        f( 3)
        g = (a + 3 )
        
        # good
        f(3)
        g = (a + 3)

        Example: EnforcedStyle: space

        # The `space` style enforces that parentheses have a space at the
        # beginning and end.
        # Note: Empty parentheses should not have spaces.
        
        # bad
        f(3)
        g = (a + 3)
        y( )
        
        # good
        f( 3 )
        g = ( a + 3 )
        y()

        Line is too long. [167/100]
        Open

                  current_menue = Goldencobra::Menue.active.where(target: current_article.public_url(false)).select{|a| a.path.map(&:title).join("/").include?(menue_id)}.first

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use compact module/class definition instead of nested style.
        Open

        module Goldencobra

        This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

        Example: EnforcedStyle: nested (default)

        # good
        # have each child on its own line
        class Foo
          class Bar
          end
        end

        Example: EnforcedStyle: compact

        # good
        # combine definitions as much as possible
        class Foo::Bar
        end

        The compact style is only forced for classes/modules with one child.

        Space missing after comma.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Surrounding space missing in default value assignment.
        Open

            def navigation_menu(menue_id, options={})

        Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end
        
        # good
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end

        Example: EnforcedStyle: no_space

        # bad
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end
        
        # good
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end

        Space between { and | missing.
        Open

              min_of_layers = menue_array.map{|a| a.ancestry.to_s.split("/").count }.min

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space inside } missing.
        Open

                link_options = {href: child_target_link}

        Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that hash literals have
        # surrounding space.
        
        # bad
        h = {a: 1, b: 2}
        
        # good
        h = { a: 1, b: 2 }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that hash literals have
        # no surrounding space.
        
        # bad
        h = { a: 1, b: 2 }
        
        # good
        h = {a: 1, b: 2}

        Example: EnforcedStyle: compact

        # The `compact` style normally requires a space inside
        # hash braces, with the exception that successive left
        # braces or right braces are collapsed together in nested hashes.
        
        # bad
        h = { a: { b: 2 } }
        
        # good
        h = { a: { b: 2 }}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces do not contain spaces.
        
        # bad
        foo = { }
        bar = {    }
        
        # good
        foo = {}
        bar = {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces contain space.
        
        # bad
        foo = {}
        
        # good
        foo = { }
        foo = {  }
        foo = {     }

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

                  if current_menue

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Prefer double-quoted strings inside interpolations.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks that quotes inside the string interpolation match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        result = "Tests #{success ? "PASS" : "FAIL"}"
        
        # good
        result = "Tests #{success ? 'PASS' : 'FAIL'}"

        Example: EnforcedStyle: double_quotes

        # bad
        result = "Tests #{success ? 'PASS' : 'FAIL'}"
        
        # good
        result = "Tests #{success ? "PASS" : "FAIL"}"

        Prefer double-quoted strings inside interpolations.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks that quotes inside the string interpolation match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        result = "Tests #{success ? "PASS" : "FAIL"}"
        
        # good
        result = "Tests #{success ? 'PASS' : 'FAIL'}"

        Example: EnforcedStyle: double_quotes

        # bad
        result = "Tests #{success ? 'PASS' : 'FAIL'}"
        
        # good
        result = "Tests #{success ? "PASS" : "FAIL"}"

        Prefer double-quoted strings inside interpolations.
        Open

              return content_tag(:li, raw(child_link), "data-id" => child.id, class: "#{ visible_child_element_count > 0 ? 'has_children' : '' } #{ (child.has_active_child?(request, subtree_menues) ? 'has_active_child' : '') if request.present? } #{ (child.is_active?(request) ? 'active' : '') if request.present? } #{ child.css_class.gsub(/\W/,' ') }".squeeze(' ').strip)

        This cop checks that quotes inside the string interpolation match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        result = "Tests #{success ? "PASS" : "FAIL"}"
        
        # good
        result = "Tests #{success ? 'PASS' : 'FAIL'}"

        Example: EnforcedStyle: double_quotes

        # bad
        result = "Tests #{success ? 'PASS' : 'FAIL'}"
        
        # good
        result = "Tests #{success ? "PASS" : "FAIL"}"

        There are no issues that match your filters.

        Category
        Status