Showing 355 of 499 total issues

Method hessenberg_to_real_schur has a Cognitive Complexity of 184 (exceeds 5 allowed). Consider refactoring.
Open

    def hessenberg_to_real_schur

      #  This is derived from the Algol procedure hqr2,
      #  by Martin and Wilkinson, Handbook for Auto. Comp.,
      #  Vol.ii-Linear Algebra, and the corresponding
Severity: Minor
Found in stdlib/matrix/eigenvalue_decomposition.rb - About 3 days 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 array.rb has 2002 lines of code (exceeds 1000 allowed). Consider refactoring.
Open

require 'corelib/enumerable'
require 'corelib/numeric'

class ::Array < `Array`
  include ::Enumerable
Severity: Major
Found in opal/corelib/array.rb - About 3 days to fix

    File runtime.js has 2000 lines of code (exceeds 1000 allowed). Consider refactoring.
    Open

    (function(global_object) {
      "use strict";
    
      // @note
      //   A few conventions for the documentation of this file:
    Severity: Major
    Found in opal/corelib/runtime.js - About 3 days to fix

      Method parse_in_order has a Cognitive Complexity of 109 (exceeds 5 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: Minor
      Found in stdlib/optparse.rb - About 2 days 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 string.rb has 1595 lines of code (exceeds 1000 allowed). Consider refactoring.
      Open

      require 'corelib/comparable'
      require 'corelib/regexp'
      
      class ::String < `String`
        include ::Comparable
      Severity: Major
      Found in opal/corelib/string.rb - About 2 days to fix

        Method make_switch has a Cognitive Complexity of 100 (exceeds 5 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: Minor
        Found in stdlib/optparse.rb - About 2 days 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 hessenberg_to_real_schur has 332 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

            def hessenberg_to_real_schur
        
              #  This is derived from the Algol procedure hqr2,
              #  by Martin and Wilkinson, Handbook for Auto. Comp.,
              #  Vol.ii-Linear Algebra, and the corresponding
        Severity: Major
        Found in stdlib/matrix/eigenvalue_decomposition.rb - About 1 day to fix

          Method parse has 225 lines of code (exceeds 30 allowed). Consider refactoring.
          Open

              def parse(string, comp = true)
                %x{
                  var current_date = new Date();
          
                  var current_day = current_date.getDate(),
          Severity: Major
          Found in stdlib/date.rb - About 1 day to fix

            Method strftime has 206 lines of code (exceeds 30 allowed). Consider refactoring.
            Open

              def strftime(format)
                %x{
                  return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) {
                    var result = "", jd, c, s,
                        zero   = flags.indexOf('0') !== -1,
            Severity: Major
            Found in opal/corelib/time.rb - About 1 day to fix

              Method _racc_evalact has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _racc_evalact(act, arg)
                    action_table, action_check, _, action_pointer,
                    _,   _, _, _,
                    _,   _, _, shift_n,  reduce_n,
                    _,   _, * = arg
              Severity: Minor
              Found in stdlib/racc/parser.rb - About 7 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 163 lines of code (exceeds 30 allowed). Consider refactoring.
              Open

                  def initialize
                    super
                    @options = {}
              
                    self.banner = 'Usage: opal [options] -- [programfile]'
              Severity: Major
              Found in lib/opal/cli_options.rb - About 6 hrs to fix

                Method thrower has a Cognitive Complexity of 39 (exceeds 5 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: Minor
                Found in lib/opal/nodes/closure.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 tr_s has 149 lines of code (exceeds 30 allowed). Consider refactoring.
                Open

                  def tr_s(from, to)
                    %x{
                      from = $coerce_to(from, #{::String}, 'to_str').$to_s();
                      to = $coerce_to(to, #{::String}, 'to_str').$to_s();
                
                
                Severity: Major
                Found in opal/corelib/string.rb - About 5 hrs to fix

                  Method irb has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def irb
                      ::Opal::IRB.ensure_loaded('opal-replutils')
                  
                      silencer = ::Opal::IRB::Silencer.new
                  
                  
                  Severity: Minor
                  Found in opal/corelib/irb.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 compile has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def compile
                          compiler.top_scope = self
                          compiler.dynamic_cache_result = true if sexp.meta[:dynamic_cache_result]
                  
                          push version_comment
                  Severity: Minor
                  Found in lib/opal/nodes/top.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 _racc_do_parse_rb has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _racc_do_parse_rb(arg, in_debug)
                        action_table, action_check, action_default, action_pointer,
                        _,            _,            _,              _,
                        _,            _,            token_table,    _,
                        _,            _,            * = arg
                  Severity: Minor
                  Found in stdlib/racc/parser.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 fill has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def fill(*args, &block)
                      %x{
                        $deny_frozen_access(self);
                  
                        var i, length, value;
                  Severity: Minor
                  Found in opal/corelib/array.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 gets has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def gets(sep = false, limit = nil, opts = {})
                      if `sep.$$is_number` && !limit
                        sep, limit, opts = false, sep, limit
                      end
                      if `sep.$$is_hash` && !limit && opts == {}
                  Severity: Minor
                  Found in opal/corelib/io.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 round has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def round(ndigits = undefined)
                      if ::Integer === self
                        if `ndigits == null`
                          return self
                        end
                  Severity: Minor
                  Found in opal/corelib/number.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 tr has 130 lines of code (exceeds 30 allowed). Consider refactoring.
                  Open

                    def tr(from, to)
                      %x{
                        from = $coerce_to(from, #{::String}, 'to_str').$to_s();
                        to = $coerce_to(to, #{::String}, 'to_str').$to_s();
                  
                  
                  Severity: Major
                  Found in opal/corelib/string.rb - About 5 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language