Showing 359 of 503 total issues

Method from_string has 67 lines of code (exceeds 30 allowed). Consider refactoring.
Open

  def self.from_string(str)
    %x{
      var re = /[+-]?[\d_]+(\.[\d_]+)?(e\d+)?/,
          match = str.match(re),
          real, imag, denominator;
Severity: Major
Found in opal/corelib/complex.rb - About 2 hrs to fix

    Method next has 67 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

      def next
        %x{
          var i = self.length;
          if (i === 0) {
            return '';
    Severity: Major
    Found in opal/corelib/string.rb - About 2 hrs to fix

      Method fill has 66 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

        def fill(*args, &block)
          %x{
            $deny_frozen_access(self);
      
            var i, length, value;
      Severity: Major
      Found in opal/corelib/array.rb - About 2 hrs to fix

        Method [] has 66 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

          def [](index, length = undefined)
            %x{
              var size = self.length, exclude, range;
        
              if (index.$$is_range) {
        Severity: Major
        Found in opal/corelib/string.rb - About 2 hrs to fix

          Method reduce_to_hessenberg has 65 lines of code (exceeds 30 allowed). Consider refactoring.
          Open

              def reduce_to_hessenberg
                #  This is derived from the Algol procedures orthes and ortran,
                #  by Martin and Wilkinson, Handbook for Auto. Comp.,
                #  Vol.ii-Linear Algebra, and the corresponding
                #  Fortran subroutines in EISPACK.
          Severity: Major
          Found in stdlib/matrix/eigenvalue_decomposition.rb - About 2 hrs to fix

            Method returns has 62 lines of code (exceeds 30 allowed). Consider refactoring.
            Open

                def returns(sexp)
                  return returns s(:nil) unless sexp
            
                  case sexp.type
                  when :undef
            Severity: Major
            Found in lib/opal/compiler.rb - About 2 hrs to fix

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

                  def join(*paths)
                    if paths.empty?
                      return ''
                    end
                    result = ''
              Severity: Minor
              Found in opal/corelib/file.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 on_send has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                    def on_send(node)
                      recv, meth, *args = *node
                      if recv && recv.type == :send
                        recv_of_recv, meth_of_recv, _ = *recv
                        if meth_of_recv == :JS
              Severity: Minor
              Found in lib/opal/rewriters/dot_js_syntax.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 ** has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                def **(other)
                  case other
                  when Integer
                    x = self
                    if other <= 0
              Severity: Minor
              Found in stdlib/matrix.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 load has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                def load(filename = nil)
                  unless filename
                    basename = File.basename($0, '.*')
                    begin
                      return true if load(File.expand_path(basename, '~/.options'))
              Severity: Minor
              Found in stdlib/optparse.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 gsub has 61 lines of code (exceeds 30 allowed). Consider refactoring.
              Open

                def gsub(pattern, replacement = undefined, &block)
                  %x{
                    if (replacement === undefined && block === nil) {
                      return #{enum_for :gsub, pattern};
                    }
              Severity: Major
              Found in opal/corelib/string.rb - About 2 hrs to fix

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

                  def **(other)
                    if other == 0
                      return ::Complex.new(1, 0)
                    end
                
                
                Severity: Minor
                Found in opal/corelib/complex.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 ** has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                  def **(other)
                    case other
                    when ::Integer
                      if self == 0 && other < 0
                        ::Float::INFINITY
                Severity: Minor
                Found in opal/corelib/rational.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 compile_masgn has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                      def compile_masgn(lhs_items, array, len = nil)
                        pre_splat  = lhs_items.take_while { |child| child.type != :splat }
                        post_splat = lhs_items.drop(pre_splat.size)
                
                        pre_splat.each_with_index do |child, idx|
                Severity: Minor
                Found in lib/opal/nodes/masgn.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 compile has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                      def compile
                        test_code = js_truthy(test)
                
                        @redo_var = scope.new_temp if uses_redo?
                
                
                Severity: Minor
                Found in lib/opal/nodes/while.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 could_become_switch_branch? has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                      def could_become_switch_branch?(body)
                        if !body
                          return true
                        elsif body.type != :if
                          if valid_switch_body?(body)
                Severity: Minor
                Found in lib/opal/nodes/if.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 diagonalize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def diagonalize
                      #  This is derived from the Algol procedures tql2, by
                      #  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
                      #  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
                      #  Fortran subroutine in EISPACK.
                Severity: Minor
                Found in stdlib/matrix/eigenvalue_decomposition.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 permutation has 57 lines of code (exceeds 30 allowed). Consider refactoring.
                Open

                  def permutation(num = undefined, &block)
                    unless block_given?
                      return enum_for(:permutation, num) do
                        `descending_factorial(self.length, num === undefined ? self.length : num)`
                      end
                Severity: Major
                Found in opal/corelib/array.rb - About 2 hrs to fix

                  Method unpack has 56 lines of code (exceeds 30 allowed). Consider refactoring.
                  Open

                    def unpack(format, offset: 0)
                      ::Kernel.raise ::ArgumentError, "offset can't be negative" if offset < 0
                      format = ::Opal.coerce_to!(format, ::String, :to_str).gsub(/\s/, '').delete("\000")
                  
                      %x{
                  Severity: Major
                  Found in opal/corelib/string/unpack.rb - About 2 hrs to fix

                    Method read has 55 lines of code (exceeds 30 allowed). Consider refactoring.
                    Open

                        def read(cache: true)
                          code = read_char
                          # The first character indicates the type of the object
                          case code
                          when '0'
                    Severity: Major
                    Found in opal/corelib/marshal/read_buffer.rb - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language