deepcerulean/dedalus

View on GitHub

Showing 15 of 15 total issues

Method walk! has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

    def walk!(structure, origin:, dimensions:, freeform: false, render: false, z_index: ZOrder::Background)
      width, height = *dimensions

      height = structure.height if !structure.is_a?(Array) && structure.height
      width  = structure.width  if !structure.is_a?(Array) && structure.width
Severity: Minor
Found in lib/dedalus/view_traversal.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 walk! has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def walk!(structure, origin:, dimensions:, freeform: false, render: false, z_index: ZOrder::Background)
      width, height = *dimensions

      height = structure.height if !structure.is_a?(Array) && structure.height
      width  = structure.width  if !structure.is_a?(Array) && structure.width
Severity: Major
Found in lib/dedalus/view_traversal.rb - About 2 hrs to fix

    Method subdivide_line has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def subdivide_line(elements, distance:, attr:)
          percent_attr = :"#{attr}_percent"
          elements_with_relative_hints = elements.select do |element|
            if element.is_a?(Array)
              false
    Severity: Minor
    Found in lib/dedalus/view_traversal.rb - About 1 hr 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 subdivide_line has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def subdivide_line(elements, distance:, attr:)
          percent_attr = :"#{attr}_percent"
          elements_with_relative_hints = elements.select do |element|
            if element.is_a?(Array)
              false
    Severity: Minor
    Found in lib/dedalus/view_traversal.rb - About 1 hr to fix

      Method create_library has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def create_library(module_to_search:, name:)
              library = Library.create(name: name)
      
              atom_section = library.create_library_section(
                name: "Atoms",
      Severity: Minor
      Found in lib/dedalus/pattern_library/application.rb - About 1 hr to fix

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

            def walk_rows!(rows, origin:, dimensions:, render: false)
              width, height = *dimensions
              x0, y0 = *origin
        
              subdivide_line(rows, distance: height, attr: :height) do |row, current_row_height, height_cursor|
        Severity: Minor
        Found in lib/dedalus/view_traversal.rb - About 1 hr 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! has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def render!(structure, dims)
              traverse(structure, origin: [0,0], dimensions: dims, render: true) do
                on_atom do |atom, origin:, dimensions:, freeform:, z_index:|
                  if atom.background_color
                    atom.draw_bounding_box(
        Severity: Minor
        Found in lib/dedalus/app_view_composer.rb - About 1 hr to fix

          Method serialize_library has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def serialize_library(library)
                  {
                    library_name: library.name,
          
                    library_sections: [welcome_section] + library.library_sections.map do |section|
          Severity: Minor
          Found in lib/dedalus/pattern_library/application.rb - About 1 hr to fix

            Method render! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def render!(structure, dims)
                  traverse(structure, origin: [0,0], dimensions: dims, render: true) do
                    on_atom do |atom, origin:, dimensions:, freeform:, z_index:|
                      if atom.background_color
                        atom.draw_bounding_box(
            Severity: Minor
            Found in lib/dedalus/app_view_composer.rb - About 1 hr 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

            Avoid deeply nested control flow statements.
            Open

                          if layer.shown.is_a?(Array)
                            layer.elements.each_with_index do |layer_element, z_offset|
                              walk!(layer_element, origin: pad_origin, dimensions: pad_dims, freeform: true, render: render, z_index: z_index+z_offset)
                            end
                          else
            Severity: Major
            Found in lib/dedalus/view_traversal.rb - About 45 mins to fix

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

                  def self.lookup_recording(id,width,height,window,force:false,&blk)
              Severity: Minor
              Found in lib/dedalus/image_repository.rb - About 35 mins to fix

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

                      def show
                        if grid
                          grid.map do |row_elements|
                            row_elements.map do |grid_value|
                              if grid_value
                Severity: Minor
                Found in lib/dedalus/elements/image_grid.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 send_molecule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def send_molecule(structure, window_dims, mouse_position:, message:)
                      mouse_coord = coord(*mouse_position)
                
                      traverse(structure, origin: [0,0], dimensions: window_dims, render: false) do
                        on_molecule do |molecule, origin:, dimensions:, z_index:|
                Severity: Minor
                Found in lib/dedalus/app_view_composer.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

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

                      def render
                        x0,y0 = *position
                        ox,oy = *offset
                
                        x_scale = invert_x ? -scale : scale
                Severity: Minor
                Found in lib/dedalus/elements/image.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

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

                      def library_items
                        if items
                          if show_table
                            PeriodicTable.new(elements: items)
                          else # items
                Severity: Minor
                Found in lib/dedalus/pattern_library/organisms/library_entry.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