Showing 419 of 503 total issues

Avoid deeply nested control flow statements.
Open

                racc_read_token(@racc_t, tok, @racc_val) if @yydebug
Severity: Major
Found in stdlib/racc/parser.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

            promise.reject(@delayed ? @delayed[0] : error)
    Severity: Major
    Found in stdlib/promise.rb - About 45 mins to fix

      Method div has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def div(other, digits = nil)
          return self / other if digits == 0
      
          other, _ = coerce(other)
      
      
      Severity: Minor
      Found in stdlib/bigdecimal.rb - About 45 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 deeply nested control flow statements.
      Open

                      unless tok      # EOF
                        @racc_t = 0
                      else
                        @racc_t = (token_table[tok] or 1)   # error token
                      end
      Severity: Major
      Found in stdlib/racc/parser.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        if (y < x)
                          s = -s
                        end
        Severity: Major
        Found in stdlib/matrix/eigenvalue_decomposition.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        rescue InvalidOption
                          raise if require_exact
                          # if no short options match, try completion with long
                          # options.
                          sw, = complete(:long, opt)
          Severity: Major
          Found in stdlib/optparse.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            if (vr == 0.0 && vi == 0.0)
                              vr = eps * norm * (w.abs + q.abs +
                              x.abs + y.abs + z.abs)
                            end
            Severity: Major
            Found in stdlib/matrix/eigenvalue_decomposition.rb - About 45 mins to fix

              Method tridiagonalize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def tridiagonalize
              
                    #  This is derived from the Algol procedures tred2 by
                    #  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
                    #  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
              Severity: Minor
              Found in stdlib/matrix/eigenvalue_decomposition.rb - About 45 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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def initialize(utime = 0.0, stime = 0.0, cutime = 0.0, cstime = 0.0, real = 0.0, label = nil)
              Severity: Minor
              Found in stdlib/benchmark.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                        case @racc_error_status
                        when 0
                          unless arg[21]    # user_yyerror
                            on_error @racc_t, @racc_val, @racc_vstack
                          end
                Severity: Major
                Found in stdlib/racc/parser.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                          while true
                            if i = action_pointer[@racc_state[-1]]
                              i += 1   # error token
                              if  i >= 0 and
                                  (act = action_table[i]) and
                  Severity: Major
                  Found in stdlib/racc/parser.rb - About 45 mins to fix

                    Method benchmark has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def benchmark(caption = "", label_width = nil, format = nil, *labels) # :yield: report
                        sync = STDOUT.sync
                        STDOUT.sync = true
                        label_width ||= 0
                        label_width += 1
                    Severity: Minor
                    Found in stdlib/benchmark.rb - About 45 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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                f = 0.0
                                high.downto(m) do |j|
                                  f += @ort[j]*@h[i][j]
                                end
                                f = f/h
                    Severity: Minor
                    Found in stdlib/matrix/eigenvalue_decomposition.rb and 1 other location - About 45 mins to fix
                    stdlib/matrix/eigenvalue_decomposition.rb on lines 390..397

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 40.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                f = 0.0
                                high.downto(m) do |i|
                                  f += @ort[i]*@h[i][j]
                                end
                                f = f/h
                    Severity: Minor
                    Found in stdlib/matrix/eigenvalue_decomposition.rb and 1 other location - About 45 mins to fix
                    stdlib/matrix/eigenvalue_decomposition.rb on lines 401..408

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 40.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                          (k+1).upto(last) do |i|
                            ai = a[i]
                            (k+1).upto(last) do |j|
                              ai[j] =  (pivot * ai[j] - ai[k] * a[k][j]) / previous_pivot
                    Severity: Minor
                    Found in stdlib/matrix.rb and 1 other location - About 45 mins to fix
                    stdlib/matrix.rb on lines 1240..1243

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 39.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            (pivot_row+1).upto(last_row) do |i|
                               ai = a[i]
                               (k+1).upto(last_column) do |j|
                                 ai[j] =  (pivot * ai[j] - ai[k] * a[pivot_row][j]) / previous_pivot
                    Severity: Minor
                    Found in stdlib/matrix.rb and 1 other location - About 45 mins to fix
                    stdlib/matrix.rb on lines 1184..1187

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 39.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      def +(v)
                        case v
                        when Vector
                          Vector.Raise ErrDimensionMismatch if size != v.size
                          els = collect2(v) {|v1, v2|
                    Severity: Minor
                    Found in stdlib/matrix.rb and 1 other location - About 45 mins to fix
                    stdlib/matrix.rb on lines 1948..1959

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 39.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      def -(v)
                        case v
                        when Vector
                          Vector.Raise ErrDimensionMismatch if size != v.size
                          els = collect2(v) {|v1, v2|
                    Severity: Minor
                    Found in stdlib/matrix.rb and 1 other location - About 45 mins to fix
                    stdlib/matrix.rb on lines 1930..1941

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 39.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      Opal.neqeq = function(lhs, rhs) {
                        return are_both_numbers_or_strings(lhs,rhs) ? lhs !== rhs : $truthy((lhs)['$!='](rhs));
                      };
                    Severity: Minor
                    Found in opal/corelib/runtime.js and 1 other location - About 40 mins to fix
                    opal/corelib/runtime.js on lines 2943..2945

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 48.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      Opal.eqeqeq = function(lhs, rhs) {
                        return are_both_numbers_or_strings(lhs,rhs) ? lhs === rhs : $truthy((lhs)['$==='](rhs));
                      };
                    Severity: Minor
                    Found in opal/corelib/runtime.js and 1 other location - About 40 mins to fix
                    opal/corelib/runtime.js on lines 2946..2948

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 48.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language