clbustos/rinruby

View on GitHub

Showing 22 of 24 total issues

File rinruby.rb has 669 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'matrix'

require File.expand_path(File.dirname(__FILE__) + '/rinruby/version.rb')

class RinRuby
Severity: Major
Found in lib/rinruby.rb - About 1 day to fix

    Method find_R_dir_on_windows has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def find_R_dir_on_windows(cygwin = false, &b)
          res = []
          b ||= proc{}
          
          # Firstly, check registry
    Severity: Minor
    Found in lib/rinruby.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 initialize has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

      def initialize(*args)
        @opts = {:echo=>true, :interactive=>true, :executable=>nil, 
            :port_number=>38442, :port_width=>1000, :hostname=>'127.0.0.1', :persistent => true}        
        if args.size==1 and args[0].is_a? Hash
          @opts.merge!(args[0])
    Severity: Minor
    Found in lib/rinruby.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 prompt has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

      def prompt(regular_prompt="> ", continue_prompt="+ ")
        warn "'interactive' mode is off in this session " unless @interactive
        
        @readline ||= begin # initialize @readline at the first invocation
          require 'readline'
    Severity: Minor
    Found in lib/rinruby.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 RinRuby has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class RinRuby
    
      require 'socket'
    
      # Exception for closed engine
    Severity: Minor
    Found in lib/rinruby.rb - About 2 hrs to fix

      Method eval_engine has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        def eval_engine(r_expr, &echo_proc)
          raise EngineClosed if (@writer.closed? || @reader.closed?)
          
          run_num = (@eval_count += 1)
          @writer.print(<<-__TEXT__)
      Severity: Minor
      Found in lib/rinruby.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 initialize has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def initialize(*args)
          @opts = {:echo=>true, :interactive=>true, :executable=>nil, 
              :port_number=>38442, :port_width=>1000, :hostname=>'127.0.0.1', :persistent => true}        
          if args.size==1 and args[0].is_a? Hash
            @opts.merge!(args[0])
      Severity: Major
      Found in lib/rinruby.rb - About 2 hrs to fix

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

          def echo(enable=nil, stderr=nil)
            next_enabled = (enable == nil) ? @echo_enabled : (enable ? true : false)
            next_stderr = case stderr
            when nil
              (next_enabled ? @echo_stderr : false) 
        Severity: Minor
        Found in lib/rinruby.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 eval_engine has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def eval_engine(r_expr, &echo_proc)
            raise EngineClosed if (@writer.closed? || @reader.closed?)
            
            run_num = (@eval_count += 1)
            @writer.print(<<-__TEXT__)
        Severity: Minor
        Found in lib/rinruby.rb - About 1 hr to fix

          Method pull_engine has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def pull_engine(string, singletons = true)
              raise EngineClosed if @writer.closed?
              
              pull_proc = proc{|var, socket|
                @writer.puts "#{RinRuby_Env}$pull(try(#{var}))"
          Severity: Minor
          Found in lib/rinruby.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 socket_session has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def socket_session(&b)
              socket = @socket
              # TODO check still available connection?
              unless socket then
                t = Thread::new{socket = @server_socket.accept}
          Severity: Minor
          Found in lib/rinruby.rb - About 1 hr to fix

            Method find_R_dir_on_windows has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def find_R_dir_on_windows(cygwin = false, &b)
                  res = []
                  b ||= proc{}
                  
                  # Firstly, check registry
            Severity: Minor
            Found in lib/rinruby.rb - About 1 hr to fix

              Method pull_engine has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def pull_engine(string, singletons = true)
                  raise EngineClosed if @writer.closed?
                  
                  pull_proc = proc{|var, socket|
                    @writer.puts "#{RinRuby_Env}$pull(try(#{var}))"
              Severity: Minor
              Found in lib/rinruby.rb - About 1 hr to fix

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

                  def prompt(regular_prompt="> ", continue_prompt="+ ")
                    warn "'interactive' mode is off in this session " unless @interactive
                    
                    @readline ||= begin # initialize @readline at the first invocation
                      require 'readline'
                Severity: Minor
                Found in lib/rinruby.rb - About 1 hr to fix

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

                    def assign_engine(fun, value, r_type = nil)
                      raise EngineClosed if @writer.closed?
                      
                      original_value = value
                      
                  Severity: Minor
                  Found in lib/rinruby.rb - About 1 hr to fix

                    Method find_R_on_windows has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def find_R_on_windows(cygwin = false)
                          return 'R' if cygwin && system('which R > /dev/nul 2>&1')
                          
                          find_R_dir_on_windows(cygwin){|path|
                            ['bin', 'bin/x64', 'bin/i386'].product(
                    Severity: Minor
                    Found in lib/rinruby.rb - About 55 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 eval has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def eval(string, echo_override = nil, &b)
                        echo_proc = case echo_override # echo on when echo_proc == nil
                        when Proc
                          echo_override
                        when nil
                    Severity: Minor
                    Found in lib/rinruby.rb - About 45 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 method_missing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def method_missing(symbol, *args)
                        name = symbol.id2name
                        if name =~ /(.*)=$/
                          raise ArgumentError, "You shouldn't assign nil" if args==[nil]
                          super if args.length != 1
                    Severity: Minor
                    Found in lib/rinruby.rb - About 45 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 socket_session has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def socket_session(&b)
                        socket = @socket
                        # TODO check still available connection?
                        unless socket then
                          t = Thread::new{socket = @server_socket.accept}
                    Severity: Minor
                    Found in lib/rinruby.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 if_complete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def if_complete(lines, &then_proc)
                        if_parseable(lines, {
                          :error_proc => proc{|var|
                            # extract last parsed position
                            l2, c2, is_separator = pull_engine(
                    Severity: Minor
                    Found in lib/rinruby.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

                    Severity
                    Category
                    Status
                    Source
                    Language