Showing 419 of 503 total issues

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

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

          Method min has 39 lines of code (exceeds 30 allowed). Consider refactoring.
          Open

            def min(n = nil, &block)
              unless n.nil?
                if block_given?
                  return sort { |a, b| yield a, b }.take n
                else
          Severity: Minor
          Found in opal/corelib/enumerable.rb - About 1 hr to fix

            Method flatten has 39 lines of code (exceeds 30 allowed). Consider refactoring.
            Open

              def flatten(level = undefined)
                %x{
                  function _flatten(array, level) {
                    var result = [],
                        i, length,
            Severity: Minor
            Found in opal/corelib/array.rb - About 1 hr to fix

              Method index has 39 lines of code (exceeds 30 allowed). Consider refactoring.
              Open

                def index(search, offset = undefined)
                  %x{
                    var index,
                        match,
                        regex;
              Severity: Minor
              Found in opal/corelib/string.rb - About 1 hr to fix

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

                  Method decode_www_form has 38 lines of code (exceeds 30 allowed). Consider refactoring.
                  Open

                    def self.decode_www_form(str, enc = undefined, separator: '&', use__charset_: false, isindex: false)
                      raise ArgumentError, "the input of #{name}.#{__method__} must be ASCII only string" unless str.ascii_only?
                  
                      %x{
                        var ary = [], key, val;
                  Severity: Minor
                  Found in stdlib/uri.rb - About 1 hr to fix

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

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

                        def initialize(size = nil, obj = nil, &block)
                          %x{
                            $deny_frozen_access(self);
                      
                            if (obj !== nil && block !== nil) {
                      Severity: Minor
                      Found in opal/corelib/array.rb - About 1 hr to fix

                        Method union has 37 lines of code (exceeds 30 allowed). Consider refactoring.
                        Open

                            def union(*parts)
                              %x{
                                var is_first_part_array, quoted_validated, part, options, each_part_options;
                                if (parts.length == 0) {
                                  return /(?!)/;
                        Severity: Minor
                        Found in opal/corelib/regexp.rb - About 1 hr to fix

                          Method inspect has 37 lines of code (exceeds 30 allowed). Consider refactoring.
                          Open

                            def self.inspect(value = undefined)
                              `var pushed = false`
                              begin
                                %x{
                                  if (value === null) {
                          Severity: Minor
                          Found in opal/corelib/helpers.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language