Showing 355 of 499 total issues

Method make_switch has 125 lines of code (exceeds 30 allowed). Consider refactoring.
Open

  def make_switch(opts, block = nil)
    short, long, nolong, style, pattern, conv, not_pattern, not_conv, not_style = [], [], []
    ldesc, sdesc, desc, arg = [], [], []
    default_style = Switch::NoArgument
    default_pattern = nil
Severity: Major
Found in stdlib/optparse.rb - About 4 hrs to fix

    Method _racc_yyparse_rb has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        def _racc_yyparse_rb(recv, mid, arg, c_debug)
          action_table, action_check, action_default, action_pointer,
          _,             _,            _,              _,
          _,            _,            token_table,    _,
          _,            _,            * = arg
    Severity: Minor
    Found in stdlib/racc/parser.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

    File optparse.rb has 1110 lines of code (exceeds 1000 allowed). Consider refactoring.
    Open

    class OptionParser
      OptionParser::Version = '0.1.1'
    
      # :stopdoc:
      NoArgument = [NO_ARGUMENT = :NONE, nil].freeze
    Severity: Major
    Found in stdlib/optparse.rb - About 4 hrs to fix

      Method compile has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

            def compile
              scope.rescue_else_sexp = children[1..-1].detect { |sexp| sexp && sexp.type != :resbody }
              _has_rescue_handlers = false
      
              if handle_rescue_else_manually?
      Severity: Minor
      Found in lib/opal/nodes/rescue.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 Integer has 108 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

        def Integer(value, base = undefined, exception: true)
          %x{
            var i, str, base_digits;
      
            exception = $truthy(#{exception});
      Severity: Major
      Found in opal/corelib/kernel.rb - About 4 hrs to fix

        Method show_version has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

          def show_version(*pkgs)
            progname = ARGV.options.program_name
            result = false
            show = proc do |klass, cname, version|
              str = progname.to_s
        Severity: Minor
        Found in stdlib/optparse/version.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 cover? has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

          def cover?(value)
            compare = ->(a, b) {
              a <=> b || 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 compile has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

              def compile
                return push('[]') if children.empty?
        
                code, work = [], []
        
        
        Severity: Minor
        Found in lib/opal/nodes/array.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 plus has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

          def plus(path1, path2) # -> path # :nodoc:
            prefix2 = path2
            index_list2 = []
            basename_list2 = []
            while (r2 = chop_basename(prefix2))
        Severity: Minor
        Found in stdlib/pathname.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 one? has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

          def one?(pattern = undefined, &block)
            count = 0
        
            if `pattern !== undefined`
              each do |*value|
        Severity: Minor
        Found in opal/corelib/enumerable.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 compile has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

              def compile
                code, work = [], []
        
                children.each do |current|
                  splat = current.type == :splat
        Severity: Minor
        Found in lib/opal/nodes/arglist.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 summarize has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            def summarize(sdone = {}, ldone = {}, width = 1, max = width - 1, indent = '')
              sopts, lopts = [], [], nil
              @short.each { |s| sdone.fetch(s) { sopts << s }; sdone[s] = true } if @short
              @long.each { |s| ldone.fetch(s) { lopts << s }; ldone[s] = true } if @long
              return if sopts.empty? && lopts.empty? # completely hidden
        Severity: Minor
        Found in stdlib/optparse.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 candidate has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

          def candidate(word)
            list = []
            case word
            when '-'
              long = short = true
        Severity: Minor
        Found in stdlib/optparse.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 tridiagonalize has 91 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

            def tridiagonalize
        
              #  This is derived from the Algol procedures tred2 by
              #  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
              #  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
        Severity: Major
        Found in stdlib/matrix/eigenvalue_decomposition.rb - About 3 hrs to fix

          Method prefork_reactor has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

                def prefork_reactor(rel_path, requires, autoloads, options)
                  prefork
          
                  processed = []
          
          
          Severity: Minor
          Found in lib/opal/builder_scheduler/prefork.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 source_map_name_for has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              def source_map_name_for(sexp)
                case sexp.type
                when :top
                  case sexp.meta[:kind]
                  when :require
          Severity: Minor
          Found in lib/opal/fragment.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 sample has 88 lines of code (exceeds 30 allowed). Consider refactoring.
          Open

            def sample(count = undefined, options = undefined)
              return at ::Kernel.rand(`self.length`) if `count === undefined`
          
              if `options === undefined`
                if (o = ::Opal.coerce_to? count, ::Hash, :to_hash)
          Severity: Major
          Found in opal/corelib/array.rb - About 3 hrs to fix

            Method minor has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

              def minor(*param)
                case param.size
                when 2
                  row_range, col_range = param
                  from_row = row_range.first
            Severity: Minor
            Found in stdlib/matrix.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 returns has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def returns(sexp)
                  return returns s(:nil) unless sexp
            
                  case sexp.type
                  when :undef
            Severity: Minor
            Found in lib/opal/compiler.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 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
              Severity
              Category
              Status
              Source
              Language