mmcs-ruby/silicium

View on GitHub

Showing 7 of 7 total issues

File algebra.rb has 310 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Silicium
  require_relative 'algebra_diff'
  require_relative 'polynomial_division'

  ##
Severity: Minor
Found in lib/algebra.rb - About 3 hrs to fix

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

        class OrientedGraph
          def initialize(initializer = [])
            @vertices = {}; @vertex_labels = {}
            @edge_labels = {}; @edge_number = 0
            initializer.each do |v|
    Severity: Minor
    Found in lib/graph.rb - About 2 hrs to fix

      Method polynom_parser has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def polynom_parser(str)
              copy_str = str.clone
              sgn_array = []                    # Array of signs
              if copy_str[0] != '-'
                sgn_array.push('+')
      Severity: Minor
      Found in lib/polynomial_division.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 initialize_cf_deg has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def initialize_cf_deg(term, par_cf, par_deg)
              return [term.to_f, 0] if free_term? term
              cf = if par_cf.empty?
                     term.include?('-') ? -1 : 1
                   else
      Severity: Minor
      Found in lib/algebra.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 add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def add(i_pos, j_pos, elem)
              if i_pos > @n || j_pos > @m || i_pos.negative? || j_pos.negative?
                raise 'out of range'
              end
      
      
      Severity: Minor
      Found in lib/silicium/sparse.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 real_differentiration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def real_differentiration(deg, coef_diff)
              loop do
                j = deg
                loop do
                  coef_diff[deg - 1][j - 1] = coef_diff[deg][j] * j
      Severity: Minor
      Found in lib/algebra.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 minimal_convex_hull_2d has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def minimal_convex_hull_2d(points)
            return points if not_polygon?(points)
      
            points.sort_by! { |p| [p.x, p.y] }
            first = points[0]
      Severity: Minor
      Found in lib/geometry.rb - About 25 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

      Severity
      Category
      Status
      Source
      Language