AndyObtiva/glimmer-dsl-swt

View on GitHub
samples/elaborate/mandelbrot_fractal.rb

Summary

Maintainability
B
6 hrs
Test Coverage

File mandelbrot_fractal.rb has 333 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'glimmer-dsl-swt'
require 'complex'
require 'concurrent/executor/fixed_thread_pool'
require 'concurrent/utility/processor_counter'
require 'concurrent/array'
Severity: Minor
Found in samples/elaborate/mandelbrot_fractal.rb - About 4 hrs to fix

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

      def calculate_points
        puts "Background calculation activated at zoom #{zoom}" if @background
        if @points_calculated
          puts "Points calculated already. Returning previously calculated points..."
          return @points
    Severity: Minor
    Found in samples/elaborate/mandelbrot_fractal.rb - About 1 hr to fix

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

        def calculate_points
          puts "Background calculation activated at zoom #{zoom}" if @background
          if @points_calculated
            puts "Points calculated already. Returning previously calculated points..."
            return @points
      Severity: Minor
      Found in samples/elaborate/mandelbrot_fractal.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 build_mandelbrot_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def build_mandelbrot_image(mandelbrot_zoom: nil)
          mandelbrot_zoom ||= zoom
          unless flyweight_mandelbrot_images.keys.include?(mandelbrot_zoom)
            the_mandelbrot = mandelbrot(mandelbrot_zoom: mandelbrot_zoom)
            width = the_mandelbrot.width
      Severity: Minor
      Found in samples/elaborate/mandelbrot_fractal.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

      There are no issues that match your filters.

      Category
      Status