KazW/RintCore

View on GitHub

Showing 33 of 33 total issues

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

      def listen
        clear_to_send!
        listen_until_online
        while listen_can_continue? do
          line = readline!
Severity: Minor
Found in lib/rint_core/driver/operations.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 set_current_position has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

      def set_current_position(line)
        if @relative
          @current_x += to_mm(line.x) unless line.x.nil?
          @current_y += to_mm(line.y) unless line.y.nil?
          @current_z += to_mm(line.z) unless line.z.nil?
Severity: Minor
Found in lib/rint_core/g_code/object.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

Method print has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def print(file)
      port = options[:port]
      baud = options[:baud]
      low_power = options[:low_power]
      baud = baud unless baud.nil?
Severity: Minor
Found in lib/rint_core/cli.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

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

      def set_limits(line)
        if line.extrusion_move?
          unless line.x.nil?
            @x_min = @current_x if @current_x < @x_min
            @x_max = @current_x if @current_x > @x_max
Severity: Minor
Found in lib/rint_core/g_code/object.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

Class Object has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Object
      include RintCore::GCode::Codes
      include RintCore::PrettyOutput

      # An array of the raw Gcode with each line as an element.
Severity: Minor
Found in lib/rint_core/g_code/object.rb - About 3 hrs to fix

    Class Line has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Line
          include RintCore::GCode::Codes
    
          # @!macro attr_accessor
          #   @!attribute [rw] $1
    Severity: Minor
    Found in lib/rint_core/g_code/line.rb - About 2 hrs to fix

      Method measure_travel has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

            def measure_travel(line)
              if @relative
                @x_travel += to_mm(line.x).abs unless line.x.nil?
                @y_travel += to_mm(line.y).abs unless line.y.nil?
                @z_travel += to_mm(line.z).abs unless line.z.nil?
      Severity: Minor
      Found in lib/rint_core/g_code/object.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 send! has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

            def send!(command, priority = false)
              return nil unless command.is_a?(String) || command.is_a?(Array)
              if online?
                if printing?
                  if priority 
      Severity: Minor
      Found in lib/rint_core/driver/operations.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

      File object.rb has 266 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'rint_core/g_code/codes'
      require 'rint_core/g_code/line'
      require 'rint_core/pretty_output'
      
      module RintCore
      Severity: Minor
      Found in lib/rint_core/g_code/object.rb - About 2 hrs to fix

        File operations.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'rint_core/g_code'
        require 'serialport'
        
        module RintCore
          module Driver
        Severity: Minor
        Found in lib/rint_core/driver/operations.rb - About 2 hrs to fix

          Method listen_until_online has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

                def listen_until_online
                  begin
                    empty_lines = 0
                    accepted_reponses = [:online,:temperature,:valid]
                    while listen_can_continue? do
          Severity: Minor
          Found in lib/rint_core/driver/operations.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 print has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def print(file)
                port = options[:port]
                baud = options[:baud]
                low_power = options[:low_power]
                baud = baud unless baud.nil?
          Severity: Major
          Found in lib/rint_core/cli.rb - About 2 hrs to fix

            Method to_s has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                  def to_s(line_number = nil)
                    return checksummed_line if line_number.nil? || !line_number.is_a?(Fixnum)
                    return prefixed_line(line_number) if @extrusion_multiplier.nil? && @speed_multiplier.nil?
            
                    new_f = multiplied_speed
            Severity: Minor
            Found in lib/rint_core/g_code/line.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 advance_queue has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def advance_queue
                    p "Advancing"
                    return false unless online? && printing?
                    p "Advancing 1"
                    wait_until_clear
            Severity: Minor
            Found in lib/rint_core/driver/queueing.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 initialize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                  def initialize(data = nil, default_speed = 2400, auto_process = true, acceleration = 1500)
                    return false if positive_number?(default_speed)
                    return false if positive_number?(acceleration)
                    if data.class == String && self.class.is_file?(data)
                      data = self.class.get_file(data)
            Severity: Minor
            Found in lib/rint_core/g_code/object.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 send_to_printer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                  def send_to_printer(line, line_number = nil)
                    p "Sent to PRINTER"
                    line = RintCore::GCode::Line.new(line) if line.include?(RintCore::GCode::Codes::SET_LINE_NUM)
                    p "Sent to PRINTER 1.5"
                    return false if line.empty?
            Severity: Minor
            Found in lib/rint_core/driver/operations.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 process has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def process
                    set_processing_variables
            
                    @lines.each do |line|
                      case line.command
            Severity: Minor
            Found in lib/rint_core/g_code/object.rb - About 1 hr to fix

              Method set_processing_variables has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def set_processing_variables
                      @x_travel = 0
                      @y_travel = 0
                      @z_travel = 0
                      @current_x = 0
              Severity: Minor
              Found in lib/rint_core/g_code/object.rb - About 1 hr to fix

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

                      def set_positions(line)
                        @current_x = to_mm(line.x) unless line.x.nil?
                        @current_y = to_mm(line.y) unless line.y.nil?
                        @current_z = to_mm(line.z) unless line.z.nil?
                        unless line.e.nil?
                Severity: Minor
                Found in lib/rint_core/g_code/object.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 advance_queue has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def advance_queue
                        p "Advancing"
                        return false unless online? && printing?
                        p "Advancing 1"
                        wait_until_clear
                Severity: Minor
                Found in lib/rint_core/driver/queueing.rb - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language