MatteoRagni/cas-rb

View on GitHub

Showing 1,530 of 1,530 total issues

Perceived complexity for simplify is too high. [16/7]
Open

    def simplify
      super
      return self if (@x == CAS::Zero and @y == CAS::Zero)
      return self if (@x == CAS::Infinity and @y == CAS::Infinity)
      return self if (@x == CAS::Infinity and @y == CAS::Zero)
Severity: Minor
Found in lib/functions/fnc-base.rb by rubocop

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Method has too many lines. [18/10]
Open

    def to_ascii
      x_ascii = []
      x_ul    = []
      x_ascii, x_ul = @x.to_ascii
      y_ascii, y_ul = @y.to_ascii
Severity: Minor
Found in bin/graph2ascii.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Perceived complexity for simplify is too high. [15/7]
Open

    def simplify
      super
      return self if (@x == CAS::Zero and @y == CAS::Zero)
      return self if (@x == CAS::Infinity and @y == CAS::Infinity)
      return self if (@x == CAS::Infinity and @y == CAS::Zero)
Severity: Minor
Found in lib/functions/fnc-base.rb by rubocop

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Class Op has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Op
    # Argument of the operation
    attr_reader :x

    # Initialize a new empty operation container. This is a virtual
Severity: Minor
Found in lib/operators/op.rb - About 2 hrs to fix

    Assignment Branch Condition size for simplify is too high. [22.67/15]
    Open

        def simplify
          super
          return self if (@x == CAS::Zero and @y == CAS::Zero)
          return self if (@x == CAS::Infinity and @y == CAS::Infinity)
          return self if (@x == CAS::Infinity and @y == CAS::Zero)
    Severity: Minor
    Found in lib/functions/fnc-base.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [16/10]
    Open

        def to_ascii
          x_ascii, x_ul = @x.to_ascii
          y_ascii, y_ul = @y.to_ascii
          x_ll = x_ascii.size - x_ul
          y_ll = y_ascii.size - y_ul
    Severity: Minor
    Found in bin/graph2ascii.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for to_ascii is too high. [21.93/15]
    Open

        def to_ascii
          x_ascii, x_baseline = @x.to_ascii
          y_ascii, _ = @y.to_ascii
    
          x_ascii = CAS::Ascii.normalize_ascii(x_ascii, self.to_ascii_x_vars_complexity)
    Severity: Minor
    Found in bin/graph2ascii.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [16/10]
    Open

        def to_ascii
          x_ascii, x_ul = @x.to_ascii
          y_ascii, y_ul = @y.to_ascii
          x_ll = x_ascii.size - x_ul
          y_ll = y_ascii.size - y_ul
    Severity: Minor
    Found in bin/graph2ascii.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [16/10]
    Open

        def to_ascii
          x_ascii, x_ul = @x.to_ascii
          y_ascii, y_ul = @y.to_ascii
          x_ll = x_ascii.size - x_ul
          y_ll = y_ascii.size - y_ul
    Severity: Minor
    Found in bin/graph2ascii.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for simplify is too high. [21.26/15]
    Open

        def simplify
          super
          return self if (@x == CAS::Zero and @y == CAS::Zero)
          return self if (@x == CAS::Infinity and @y == CAS::Infinity)
          return self if (@x == CAS::Infinity and @y == CAS::Zero)
    Severity: Minor
    Found in lib/functions/fnc-base.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [15/10]
    Open

        def to_ascii
          x_ascii, _ = @x.to_ascii
          y_ascii, _ = @y.to_ascii
    
          x_ascii = CAS::Ascii.normalize_ascii x_ascii
    Severity: Minor
    Found in bin/graph2ascii.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [15/10]
    Open

        def subs(dt)
          CAS::Help.assert(dt, Hash)
          @x = @x.map { |z| z.subs(dt) || z }
          @x.each_with_index do |x, k|
            sub = dt.keys.select { |e| e == x }[0]
    Severity: Minor
    Found in lib/operators/nary-op.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Cyclomatic complexity for reduce_associativity is too high. [11/6]
    Open

        def reduce_associativity
          pos, neg = [], []
    
          @x.each do |x_el|
            case x_el
    Severity: Minor
    Found in lib/functions/fnc-sum.rb by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Assignment Branch Condition size for to_ascii is too high. [19.24/15]
    Open

        def to_ascii
          x_ascii, x_baseline = CAS::E.to_ascii
          y_ascii, _ = @x.to_ascii
    
          x_ascii = CAS::Ascii.normalize_ascii(x_ascii)
    Severity: Minor
    Found in bin/graph2ascii.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for source is too high. [19.24/15]
    Open

        def source
          functions = []
    
          self.each do |fname, op|
            c_op = op.to_c.sort_by { |_k, c| c[:id] }
    Severity: Minor
    Found in lib/Mr.CAS/c-opt.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [14/10]
    Open

        def subs_rhs(dt)
          CAS::Help.assert(dt, Hash)
          sub = dt.keys.select { |e| e == @y }[0]
          if sub
            if dt[sub].is_a? CAS::Op
    Severity: Minor
    Found in lib/operators/bary-op.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [14/10]
    Open

        def subs_lhs(dt)
          CAS::Help.assert(dt, Hash)
          sub = dt.keys.select { |e| e == @x }[0]
          if sub
            if dt[sub].is_a? CAS::Op
    Severity: Minor
    Found in lib/operators/bary-op.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for subs is too high. [19.82/15]
    Open

        def subs(dt)
          CAS::Help.assert(dt, Hash)
          @x = @x.map { |z| z.subs(dt) || z }
          @x.each_with_index do |x, k|
            sub = dt.keys.select { |e| e == x }[0]
    Severity: Minor
    Found in lib/operators/nary-op.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [14/10]
    Open

        def subs(dt)
          CAS::Help.assert(dt, Hash)
          sub = dt.keys.select { |e| e == @x }[0]
          if sub
            if dt[sub].is_a? CAS::Op
    Severity: Minor
    Found in lib/operators/op.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [13/10]
    Open

        def __reduce_multeplicity(xs)
          count = Hash.new(0)
          xs.each do |x|
            e = x
            count.keys.each { |d| e = d if x == d  }
    Severity: Minor
    Found in lib/operators/nary-op.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Severity
    Category
    Status
    Source
    Language