zachinglis/crummy

View on GitHub

Showing 8 of 8 total issues

Method render_crumbs has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    def render_crumbs(crumbs, options = {})

      options[:skip_if_blank] ||= Crummy.configuration.skip_if_blank
      return '' if options[:skip_if_blank] && crumbs.count < 1
      options[:format] ||= Crummy.configuration.format
Severity: Minor
Found in lib/crummy/standard_renderer.rb - About 7 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method crumb_to_html_list has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    def crumb_to_html_list(crumb, links, li_class, first_class, last_class, is_first, is_last, with_microdata, last_crumb_linked, truncate, separator='')
      name, url, options = crumb
      options = {} unless options.is_a?(Hash)
      can_link = url && links && (!is_last || last_crumb_linked) && !(/<\/a/ =~ name)
      html_classes = []
Severity: Minor
Found in lib/crummy/standard_renderer.rb - About 5 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

      def add_crumb(name, *args)
        options = args.extract_options!
        url = args.first
        raise ArgumentError, "Need more arguments" unless name or options[:record] or block_given?
        raise ArgumentError, "Cannot pass url and use block" if url && block_given?
Severity: Minor
Found in lib/crummy/action_controller.rb - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method render_crumbs has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def render_crumbs(crumbs, options = {})

      options[:skip_if_blank] ||= Crummy.configuration.skip_if_blank
      return '' if options[:skip_if_blank] && crumbs.count < 1
      options[:format] ||= Crummy.configuration.format
Severity: Major
Found in lib/crummy/standard_renderer.rb - About 3 hrs to fix

    Method crumb_to_html has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def crumb_to_html(crumb, links, first_class, last_class, is_first, is_last, with_microdata, last_crumb_linked, truncate)
          html_classes = []
          html_classes << first_class if is_first
          html_classes << last_class if is_last
          name, url, options = crumb
    Severity: Minor
    Found in lib/crummy/standard_renderer.rb - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Method crumb_to_html_list has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def crumb_to_html_list(crumb, links, li_class, first_class, last_class, is_first, is_last, with_microdata, last_crumb_linked, truncate, separator='')
    Severity: Major
    Found in lib/crummy/standard_renderer.rb - About 1 hr to fix

      Method crumb_to_html has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def crumb_to_html(crumb, links, first_class, last_class, is_first, is_last, with_microdata, last_crumb_linked, truncate)
      Severity: Major
      Found in lib/crummy/standard_renderer.rb - About 1 hr to fix

        Method crumb_to_xml has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def crumb_to_xml(crumb, links, separator, is_first, is_last)
        Severity: Minor
        Found in lib/crummy/standard_renderer.rb - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language