MatteoRagni/cas-rb

View on GitHub

Showing 1,530 of 1,530 total issues

Perceived complexity for reduce_associativity is too high. [10/7]
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 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. [13/10]
Open

    def initialize(x, lower, upper)
      if lower.is_a? Numeric
        lower = CAS::const lower
      end
      if upper.is_a? Numeric
Severity: Minor
Found in lib/functions/fnc-box-conditions.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. [12/10]
Open

    def self.normalize_ascii(x_lines, type=nil)
      x_width = x_lines.map(&:size).max
      x_lines = x_lines.map { |l| l + (" " * (x_width - l.size)) }
      if (type == :complex and x_lines.size > 1)
        x_lines = x_lines.map { |l| l = "⎜#{l}⎟" }
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 subs_rhs is too high. [17.52/15]
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 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 subs is too high. [17.52/15]
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 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 subs_lhs is too high. [17.52/15]
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 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. [12/10]
Open

    def simplify
      hash = @x.to_s
      @x = @x.simplify
      while @x.to_s != hash
        hash = @x.to_s
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. [12/10]
Open

    def box(x, a, b, type=:closed)
      case type
      when :closed
        return CAS::BoxConditionClosed.new(x, a, b)
      when :open
Severity: Minor
Found in lib/functions/fnc-box-conditions.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 diff is too high. [17.38/15]
Open

    def diff(v)
      diff_x, diff_y = super v
      if diff_y == CAS::Zero
        return ((@x ** (@y - 1.0)) * @y * diff_x)
      elsif diff_x == 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. [12/10]
Open

    def simplify
      super
      return CAS::Zero if @x.include? CAS::Zero
      @x = @x - [CAS::One]
      return CAS::One if @x.size == 0
Severity: Minor
Found in lib/functions/fnc-prod.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. [12/10]
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 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 simplify is too high. [8/6]
Open

    def simplify
      super
      return CAS.invert(@y) if @x == CAS::Zero
      return @x if @y == CAS::Zero
      return CAS::Zero if @x == @y
Severity: Minor
Found in lib/functions/fnc-base.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. [16.19/15]
Open

    def to_ascii
      x_ascii, x_bl = @x.to_ascii
      x_ascii = CAS::Ascii.normalize_ascii x_ascii

      ret = []
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 ** is too high. [16.06/15]
Open

      def **(v)
        t = (v.y == 0 ? 0 : @x * log(@x) * v.y)
        DualNumber.new @x ** v.x, (@x ** (v.x - 1)) * (v.x * @y + t)
      end
Severity: Minor
Found in lib/Mr.CAS/auto-diff.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 header is too high. [16/15]
Open

    def header
      <<-TO_HEADER
// Header file for library: #{@name}.c

#ifndef #{@name}_H
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. [11/10]
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 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. [8/7]
Open

    def simplify
      super
      return CAS.invert(@y) if @x == CAS::Zero
      return @x if @y == CAS::Zero
      return CAS::Zero if @x == @y
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

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

    def simplify
      super
      return CAS.invert(@y) if @x == CAS::Zero
      return @x if @y == CAS::Zero
      return CAS::Zero if @x == @y
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

Assignment Branch Condition size for new is too high. [15.3/15]
Open

    def Function.new(name, *xs)
      xs.flatten!
      if @@container[name]
        # return @@container[name] if (@@container[name].x.uniq - xs.uniq == [] or xs.size == 0)
        return @@container[name] if (@@container[name].x.uniq.map(&:to_s).sort == xs.uniq.map(&:to_s).sort or xs.size == 0)
Severity: Minor
Found in lib/numbers/functions.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 simplify is too high. [15.39/15]
Open

    def simplify
      super
      return CAS::Zero if @x.include? CAS::Zero
      @x = @x - [CAS::One]
      return CAS::One if @x.size == 0
Severity: Minor
Found in lib/functions/fnc-prod.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

Severity
Category
Status
Source
Language