gogotanaka/Hilbert

View on GitHub

Showing 14 of 16 total issues

Method execute has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def execute(lexed)
      time = Time.now
      until lexed.token_str =~ /\A:(NLIN|R)\d+\z/

if Time.now > time + 10
Severity: Major
Found in lib/hilbert/parser.rb - About 2 hrs to fix

    Method execute has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.execute(str)
            lexed = Lexer::FormulaLexer.new(str)
            time = Time.now
            loop do
              if Time.now > time + 10
    Severity: Minor
    Found in lib/hilbert/parser/formula_parser.rb - About 2 hrs 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 execute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute(lexed)
          time = Time.now
          until lexed.token_str =~ /\A:(NLIN|R)\d+\z/
    
    if Time.now > time + 10
    Severity: Minor
    Found in lib/hilbert/parser.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 execute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.execute(str)
            lexed = Lexer::FormulaLexer.new(str)
            time = Time.now
            loop do
              if Time.now > time + 10
    Severity: Minor
    Found in lib/hilbert/parser/formula_parser.rb - About 1 hr to fix

      Function quadrature has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def quadrature(func, a, b, args=(), tol=1.49e-8, rtol=1.49e-8, maxiter=50,
      Severity: Major
      Found in legacy_rspec/langs/Python/ex1_after.py - About 1 hr to fix

        Function quadrature has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def quadrature(func, a, b, args=(), tol=1.49e-8, rtol=1.49e-8, maxiter=50,
        Severity: Major
        Found in legacy_rspec/langs/Python/ex1_before.py - About 1 hr to fix

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

                  def !@
                    if is_or?
                      if and_form = vars.find { |var| var.is_and? }
                        and_form.vars.map { |a| a + FORM.new((vars - [and_form]), :+) }.inject(:*)
                      elsif are_there_neg?
          Severity: Minor
          Found in lib/hilbert/world/propositional_logic.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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def initialize(str)
                  ss = StringScanner.new(str)
                  @lexeds = []
                  until ss.eos?
                    scan_rslt, ss = scan(ss)
          Severity: Minor
          Found in lib/hilbert/lexer/base.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

          Function fixed_quad has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def fixed_quad(func,a,b,args=(),n=5):
          Severity: Minor
          Found in legacy_rspec/langs/Python/ex1_before.py - About 35 mins to fix

            Function fixed_quad has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def fixed_quad(func,a,b,args=(),n=5):
            Severity: Minor
            Found in legacy_rspec/langs/Python/ex1_after.py - About 35 mins to fix

              Function vfunc has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                      def vfunc(x):
                          if isscalar(x):
                              return func(x, *args)
                          x = asarray(x)
                          # call with first point to get output type
              Severity: Minor
              Found in legacy_rspec/langs/Python/ex1_before.py - 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

              Function vfunc has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                      def vfunc(x):
                          if isscalar(x):
                              return func(x, *args)
                          x = asarray(x)
                          # call with first point to get output type
              Severity: Minor
              Found in legacy_rspec/langs/Python/ex1_after.py - 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 output! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def output!
                      ch_compile_type(@args.first)
                      parse_string = parse(@args[1])
                      write!(@args[2], parse_string)
              
              
              Severity: Minor
              Found in lib/hilbert/exec.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 optimize_output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.optimize_output(ruby_obj)
              
                    case ruby_obj
                    when Matrix, Vector, Dydx::Algebra::Formula
                      ruby_obj.to_q
              Severity: Minor
              Found in lib/hilbert/iq.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