Showing 359 of 503 total issues

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

        def prefork_reactor(rel_path, requires, autoloads, options)
          prefork

          processed = []

Severity: Major
Found in lib/opal/builder/scheduler/prefork.rb - About 2 hrs to fix

    Function $allocate_class has 54 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

      function $allocate_class(name, superclass, singleton) {
        var klass, bridged_descendant;
    
        if (bridged_descendant = descends_from_bridged_class(superclass)) {
          // Inheritance from bridged classes requires
    Severity: Major
    Found in opal/corelib/runtime.js - About 1 hr to fix

      Method run_chrome_server has 54 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

            def run_chrome_server
              raise 'Chrome server can be started only on localhost' if chrome_host != DEFAULT_CHROME_HOST
      
              profile = mktmpprofile
      
      
      Severity: Major
      Found in lib/opal/cli_runners/chrome.rb - About 1 hr to fix

        Method source_map_name_for has 54 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

            def source_map_name_for(sexp)
              case sexp.type
              when :top
                case sexp.meta[:kind]
                when :require
        Severity: Major
        Found in lib/opal/fragment.rb - About 1 hr to fix

          Method compile has 53 lines of code (exceeds 30 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: Major
          Found in lib/opal/nodes/rescue.rb - About 1 hr to fix

            Method all? has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

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

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

              def getopts(*args)
                argv = Array === args.first ? args.shift : default_argv
                single_options, *long_options = *args
            
                result = {}
            Severity: Minor
            Found in stdlib/optparse.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 ls has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def ls(object, colorize)
                methods = imethods = object.methods
                ancestors = object.class.ancestors
                constants = []
                ivs = object.instance_variables
            Severity: Minor
            Found in stdlib/opal-replutils.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 to_i has 51 lines of code (exceeds 30 allowed). Consider refactoring.
            Open

              def to_i(base = 10)
                %x{
                  var result,
                      string = self.toLowerCase(),
                      radix = $coerce_to(base, #{::Integer}, 'to_int');
            Severity: Major
            Found in opal/corelib/string.rb - About 1 hr to fix

              Method DelegateClass has 49 lines of code (exceeds 30 allowed). Consider refactoring.
              Open

              def DelegateClass(superclass, &block)
                klass = Class.new(Delegator)
                ignores = [*::Delegator.public_api, :to_s, :inspect, :=~, :!~, :===]
                protected_instance_methods = superclass.protected_instance_methods
                protected_instance_methods -= ignores
              Severity: Minor
              Found in stdlib/delegate.rb - About 1 hr to fix

                Method define_method has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def define_method(name, method = undefined, &block)
                    %x{
                      $deny_frozen_access(self);
                
                      if (method === undefined && block === nil)
                Severity: Minor
                Found in opal/corelib/module.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 evals_or_file_source has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def evals_or_file_source
                      return if lib_only # --library
                      return @cached_content if @cached_content
                
                      unless file.tty?
                Severity: Minor
                Found in lib/opal/cli.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 initialize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def initialize
                      super
                      @options = {}
                
                      self.banner = 'Usage: opal [options] -- [programfile]'
                Severity: Minor
                Found in lib/opal/cli_options.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 firefox_executable has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                      def firefox_executable
                        ENV['MOZILLA_FIREFOX_BINARY'] ||
                          if OS.windows?
                            [
                              'C:/Program Files/Mozilla Firefox/firefox.exe'
                Severity: Minor
                Found in lib/opal/cli_runners/firefox.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 match has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                        def match(ast, matcher)
                          return false if ast.nil?
                
                          ast_parts = [ast.type] + ast.children
                          self_parts = [type] + children
                Severity: Minor
                Found in lib/opal/ast/matcher.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 chrome_executable has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                      def chrome_executable
                        ENV['GOOGLE_CHROME_BINARY'] ||
                          if OS.windows?
                            [
                              'C:/Program Files/Google/Chrome Dev/Application/chrome.exe',
                Severity: Minor
                Found in lib/opal/cli_runners/chrome.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 laplace_expansion has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def laplace_expansion(row: nil, column: nil)
                    num = row || column
                
                    if !num || (row && column)
                      raise ArgumentError, "exactly one the row or column arguments must be specified"
                Severity: Minor
                Found in stdlib/matrix.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 index has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def index(*args)
                    raise ArgumentError, "wrong number of arguments(#{args.size} for 0-2)" if args.size > 2
                    which = (args.size == 2 || SELECTORS.include?(args.last)) ? args.pop : :all
                    return to_enum :find_index, which, *args unless block_given? || args.size == 1
                    if args.size == 1
                Severity: Minor
                Found in stdlib/matrix.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 permutation? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def permutation?
                    Matrix.Raise ErrDimensionMismatch unless square?
                    cols = Array.new(column_count)
                    rows.each_with_index do |row, i|
                      found = false
                Severity: Minor
                Found in stdlib/matrix.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

                Severity
                Category
                Status
                Source
                Language