Wolox/dictum

View on GitHub

Showing 6 of 6 total issues

Method write_page has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    def write_page(resource_name, information) # rubocop:disable AbcSize, Metrics/MethodLength
      context = page_context(information)

      html = Biruda.create_html(context: context) do
        instance_eval(&HTML_HEADER)
Severity: Minor
Found in lib/dictum/html_writer.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 write_page has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def write_page(resource_name, information) # rubocop:disable AbcSize, Metrics/MethodLength
      context = page_context(information)

      html = Biruda.create_html(context: context) do
        instance_eval(&HTML_HEADER)
Severity: Minor
Found in lib/dictum/html_writer.rb - About 1 hr to fix

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

        def write_error_codes_page # rubocop:disable AbcSize, Metrics/MethodLength
          context = @config.merge(error_codes: error_codes)
    
          html = Biruda.create_html(context: context) do
            instance_eval(&HTML_HEADER)
    Severity: Minor
    Found in lib/dictum/html_writer.rb - About 1 hr to fix

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

          def write_index # rubocop:disable AbcSize, Metrics/MethodLength
            context = @config.merge(error_codes: error_codes, resources: resources)
      
            html = Biruda.create_html(context: context) do
              instance_eval(&HTML_HEADER)
      Severity: Minor
      Found in lib/dictum/html_writer.rb - About 1 hr to fix

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

            def write_index # rubocop:disable AbcSize, Metrics/MethodLength
              context = @config.merge(error_codes: error_codes, resources: resources)
        
              html = Biruda.create_html(context: context) do
                instance_eval(&HTML_HEADER)
        Severity: Minor
        Found in lib/dictum/html_writer.rb - About 35 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            def resource(arguments = {})
              return if arguments.nil?
              name = arguments[:name]
              description = arguments[:description]
              return if name.nil?
        Severity: Minor
        Found in lib/dictum/documenter.rb - About 25 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Severity
        Category
        Status
        Source
        Language