Showing 359 of 503 total issues

Method solve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def solve b
      if (singular?)
        Matrix.Raise Matrix::ErrNotRegular, "Matrix is singular."
      end
      if b.is_a? Matrix
Severity: Minor
Found in stdlib/matrix/lup_decomposition.rb - About 35 mins 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 Raise has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def E2MM.Raise(klass = E2MM, err = nil, *rest)
    if form = e2mm_message(klass, err)
      b = $@.nil? ? caller(1) : $@
      b.shift if b[0] =~ /^#{Regexp.quote(__FILE__)}:/
      raise err, sprintf(form, *rest), b
Severity: Minor
Found in stdlib/e2mmap.rb - About 35 mins 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 system has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def system(*argv, exception: false)
    env = {}
    env = argv.shift if argv.first.is_a? Hash
    env = ENV.merge(env).to_n
    cmdname = argv.shift
Severity: Minor
Found in stdlib/nodejs/kernel.rb - About 35 mins 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 compsys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def compsys(sdone, ldone) # :nodoc:
      sopts, lopts = [], []
      @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 35 mins 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 Native has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def Native(obj)
    if `#{obj} == null`
      nil
    elsif native?(obj)
      Native::Object.new(obj)
Severity: Minor
Found in stdlib/native.rb - About 35 mins 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 independent? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def Vector.independent?(*vs)
    vs.each do |v|
      raise TypeError, "expected Vector, got #{v.class}" unless v.is_a?(Vector)
      Vector.Raise ErrDimensionMismatch unless v.size == vs.first.size
    end
Severity: Minor
Found in stdlib/matrix.rb - About 35 mins 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 shellsplit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def shellsplit(line)
    line += ' ' # Somehow this is needed for the JS regexp engine
    words = []
    field = String.new
    line.scan(/\s*(?:([^\s\\\'\"]+)|'([^\']*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\r?\n?\Z|\s)?/m) do |(word, sq, dq, esc, garbage, sep)|
Severity: Minor
Found in stdlib/shellwords.rb - About 35 mins 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 __prepare_require__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def __prepare_require__(path)
    name = `Opal.normalize(#{path})`
    full_path = name.end_with?('.rb') ? name : name + '.rb'

    if `!Opal.modules[#{name}]`
Severity: Minor
Found in stdlib/nodejs/require.rb - About 35 mins 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 reject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def reject(value = nil)
    if realized?
      raise ArgumentError, 'the promise has already been realized'
    end

Severity: Minor
Found in stdlib/promise.rb - About 35 mins 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

Avoid too many return statements within this method.
Open

    return false if @begin && compare.call(@begin, value) > 0
Severity: Major
Found in opal/corelib/range.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return 0
    Severity: Major
    Found in opal/corelib/number.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return self
      Severity: Major
      Found in opal/corelib/number.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return true if @end.nil?
        Severity: Major
        Found in opal/corelib/range.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return !val_max.nil? && compare.call(val_max, @end) <= 0
          Severity: Major
          Found in opal/corelib/range.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return false unless valid_switch_body?(true_body)
            Severity: Major
            Found in lib/opal/nodes/if.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return File.dirname(Opal::Compiler.module_name(@compiler.file))
              Severity: Major
              Found in lib/opal/nodes/call/require.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return false unless switch_variable == @switch_variable
                Severity: Major
                Found in lib/opal/nodes/if.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                    return expand_path(*parts)
                  Severity: Major
                  Found in lib/opal/nodes/call/require.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return false unless could_become_switch_branch?(false_body)
                    Severity: Major
                    Found in lib/opal/nodes/if.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return false unless valid_switch_body?(true_body)
                      Severity: Major
                      Found in lib/opal/nodes/if.rb - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language