Showing 359 of 503 total issues

Method diagonalize has 86 lines of code (exceeds 30 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: Major
Found in stdlib/matrix/eigenvalue_decomposition.rb - About 3 hrs to fix

    Method mktmpprofile has 85 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

          def mktmpprofile
            # for prefs see https://github.com/puppeteer/puppeteer/blob/main/packages/browsers/src/browser-data/firefox.ts
            # and https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/node/FirefoxLauncher.ts
            profile = Dir.mktmpdir('firefox-opal-profile-')
            default_prefs = {
    Severity: Major
    Found in lib/opal/cli_runners/firefox.rb - About 3 hrs to fix

      Method step has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def step(n = undefined)
          %x{
            function coerceStepSize() {
              if (n == null) {
                n = 1;
      Severity: Minor
      Found in opal/corelib/range.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 handle_part has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

              def handle_part(sexp, missing_dynamic_require = @missing_dynamic_require)
                if sexp
                  case sexp.type
                  when :str
                    return sexp.children[0]
      Severity: Minor
      Found in lib/opal/nodes/call/require.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 >> has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def >>(promise)
          @next << promise
      
          if exception?
            promise.reject(@delayed[0])
      Severity: Minor
      Found in stdlib/promise.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 step has 79 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

        def step(n = undefined)
          %x{
            function coerceStepSize() {
              if (n == null) {
                n = 1;
      Severity: Major
      Found in opal/corelib/range.rb - About 2 hrs to fix

        Method run_firefox_server has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

              def run_firefox_server
                raise 'Firefox server can be started only on localhost' if chrome_host != DEFAULT_CHROME_HOST
        
                profile = mktmpprofile
        
        
        Severity: Minor
        Found in lib/opal/cli_runners/firefox.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 def_formatter has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.def_formatter(name, format, on_utc: false, utc_tz: nil, tz_format: nil, fractions: false, on: self)
            on.define_method name do |fdigits = 0|
              case self
              when defined?(::DateTime) && ::DateTime
                date = on_utc ? new_offset(0) : self
        Severity: Minor
        Found in stdlib/time.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 split has 77 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

          def split(pattern = undefined, limit = undefined)
            %x{
              if (self.length === 0) {
                return [];
              }
        Severity: Major
        Found in opal/corelib/string.rb - About 2 hrs to fix

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

            def []=(index, value, extra = undefined)
              `$deny_frozen_access(self)`
          
              data = nil
              %x{
          Severity: Major
          Found in opal/corelib/array.rb - About 2 hrs to fix

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

              def cycle(n = nil, &block)
                unless block_given?
                  return enum_for(:cycle, n) do
                    if n.nil?
                      respond_to?(:size) ? ::Float::INFINITY : nil
            Severity: Minor
            Found in opal/corelib/enumerable.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 js_truthy_optimize has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                  def js_truthy_optimize(sexp)
                    case sexp.type
                    when :send
                      receiver, mid, *args = *sexp
                      receiver_handler_class = receiver && compiler.handlers[receiver.type]
            Severity: Minor
            Found in lib/opal/nodes/helpers.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 gamma has 71 lines of code (exceeds 30 allowed). Consider refactoring.
            Open

              def gamma(n)
                n = Math.float!(n)
            
                %x{
                  var i, t, x, value, result, twoN, threeN, fourN, fiveN;
            Severity: Major
            Found in opal/corelib/math.rb - About 2 hrs to fix

              Method _racc_evalact has 71 lines of code (exceeds 30 allowed). Consider refactoring.
              Open

                  def _racc_evalact(act, arg)
                    action_table, action_check, _, action_pointer,
                    _,   _, _, _,
                    _,   _, _, shift_n,  reduce_n,
                    _,   _, * = arg
              Severity: Major
              Found in stdlib/racc/parser.rb - About 2 hrs to fix

                Method parse_in_order has 70 lines of code (exceeds 30 allowed). Consider refactoring.
                Open

                  def parse_in_order(argv = default_argv, setter = nil, &nonopt) # :nodoc:
                    opt, arg, val, rest = nil
                    nonopt ||= proc { |a| throw :terminate, a }
                    argv.unshift(arg) if arg = catch(:terminate) do
                      while arg = argv.shift
                Severity: Major
                Found in stdlib/optparse.rb - About 2 hrs to fix

                  Method eval_ruby has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def eval_ruby(code)
                        builder = Opal::Builder.new
                        silencer = Silencer.new
                  
                        code = "#{@incomplete}#{code}"
                  Severity: Minor
                  Found in lib/opal/repl.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_array has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def on_array(node)
                          children = node.children
                  
                          # Optimize large arrays produced by lexer, but mainly we are interested
                          # in improving compile times, by reducing the tree for the further
                  Severity: Minor
                  Found in lib/opal/rewriters/targeted_patches.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 complete has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def complete(key, icase = false, pat = nil)
                        candidates = candidate(key, icase, pat, &method(:each)).sort_by { |k, v, kn| kn.size }
                        if candidates.size == 1
                          canon, sw, * = candidates[0]
                        elsif candidates.size > 1
                  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 thrower has 69 lines of code (exceeds 30 allowed). Consider refactoring.
                  Open

                          def thrower(type, value = nil)
                            case type
                            when :return
                              thrower_closure = select_closure(DEF, break_after: MODULE | TOP)
                              last_closure = select_closure(JS_FUNCTION)
                  Severity: Major
                  Found in lib/opal/nodes/closure.rb - About 2 hrs to fix

                    Method slice! has 68 lines of code (exceeds 30 allowed). Consider refactoring.
                    Open

                      def slice!(index, length = undefined)
                        `$deny_frozen_access(self)`
                    
                        result = nil
                    
                    
                    Severity: Major
                    Found in opal/corelib/array.rb - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language