Showing 359 of 503 total issues

Method relative_path_from has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def relative_path_from(base_directory)
    dest_directory = cleanpath.to_s
    base_directory = base_directory.cleanpath.to_s
    dest_prefix = dest_directory
    dest_names = []
Severity: Minor
Found in stdlib/pathname.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

Function hash has 44 lines of code (exceeds 30 allowed). Consider refactoring.
Open

  Opal.hash = function () {
    var arguments_length = arguments.length,
      args,
      hash,
      i,
Severity: Minor
Found in opal/corelib/runtime.js - About 1 hr to fix

    Method == has 43 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

      def ==(other)
        %x{
          var recursed = {};
    
          function _eqeq(array, other) {
    Severity: Minor
    Found in opal/corelib/array.rb - About 1 hr to fix

      Method pack has 42 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

        def pack(format)
          format = ::Opal.coerce_to!(format, ::String, :to_str).gsub(/\s/, '').delete("\000")
      
          %x{
            var output = '';
      Severity: Minor
      Found in opal/corelib/array/pack.rb - About 1 hr to fix

        Method initialize has 42 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

            def initialize a
              raise TypeError, "Expected Matrix but got #{a.class}" unless a.is_a?(Matrix)
              # Use a "left-looking", dot-product, Crout/Doolittle algorithm.
              @lu = a.to_a
              @row_count = a.row_count
        Severity: Minor
        Found in stdlib/matrix/lup_decomposition.rb - About 1 hr to fix

          Method product has 41 lines of code (exceeds 30 allowed). Consider refactoring.
          Open

            def product(*args, &block)
              %x{
                var result = #{block_given?} ? null : [],
                    n = args.length + 1,
                    counters = new Array(n),
          Severity: Minor
          Found in opal/corelib/array.rb - About 1 hr to fix

            Method cycle has 41 lines of code (exceeds 30 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 1 hr to fix

              Method gets has 41 lines of code (exceeds 30 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 1 hr to fix

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

                  def include?(val)
                    if `self.begin.$$is_number || self.end.$$is_number` ||
                       @begin.is_a?(::Time) || @end.is_a?(::Time) ||
                       ::Integer.try_convert(@begin) || ::Integer.try_convert(@end)
                      return cover?(val)
                Severity: Minor
                Found in opal/corelib/range.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 none? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  def none?(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 any? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  def any?(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_safari_driver has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def run_safari_driver
                        raise 'Safari driver can be started only on localhost' if safari_driver_host != DEFAULT_SAFARI_DRIVER_HOST
                
                        started = false
                
                
                Severity: Minor
                Found in lib/opal/cli_runners/safari.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 compile_merge has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def compile_merge
                        result, seq = [], []
                
                        children.each do |child|
                          if child.type == :kwsplat
                Severity: Minor
                Found in lib/opal/nodes/hash.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 compile_catcher has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                        def compile_catcher
                          catchers = @closure.catchers
                
                          return if catchers.empty?
                
                
                Severity: Minor
                Found in lib/opal/nodes/closure.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 implicit_arglist has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def implicit_arglist
                        args = []
                        kwargs = []
                
                        def_scope.original_args.children.each do |sexp|
                Severity: Minor
                Found in lib/opal/nodes/super.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 eval_and_print has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  def eval_and_print(func, mode, colorize, binding = nil)
                    printer = if colorize
                                ->(i) do
                                  ColorPrinter.default(i)
                                rescue => e
                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 candidate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.candidate(key, icase = false, pat = nil, &block)
                      pat ||= Completion.regexp(key, icase)
                      candidates = []
                      block.call do |k, *v|
                        (if Regexp === k
                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 join has 40 lines of code (exceeds 30 allowed). Consider refactoring.
                Open

                  def join(sep = nil)
                    return '' if `self.length === 0`
                
                    if `sep === nil`
                      sep = $,
                Severity: Minor
                Found in opal/corelib/array.rb - About 1 hr to fix

                  Method hash has 40 lines of code (exceeds 30 allowed). Consider refactoring.
                  Open

                    def hash
                      %x{
                        var top = ($hash_ids === undefined),
                            hash_id = self.$object_id(),
                            result = $opal32_init(),
                  Severity: Minor
                  Found in opal/corelib/hash.rb - About 1 hr to fix

                    Method sub has 40 lines of code (exceeds 30 allowed). Consider refactoring.
                    Open

                      def sub(pattern, replacement = undefined, &block)
                        %x{
                          if (!pattern.$$is_regexp) {
                            pattern = $coerce_to(pattern, #{::String}, 'to_str');
                            pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
                    Severity: Minor
                    Found in opal/corelib/string.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language