raubarede/Ruiby

View on GitHub
samples/benchi.rb

Summary

Maintainability
D
2 days
Test Coverage

Method component has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

  def component()
    stack do
    #------------ title + entry
    stacki do
      flow do
Severity: Minor
Found in samples/benchi.rb - About 6 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 bench has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def bench(code)
     begin
        eval( "class Test ; def self.test()  #{([code]*100).join(" ; ")} ;  end ; end ",$global)
        __i=0
        istep=100 # number of Test.test() in the while()
Severity: Major
Found in samples/benchi.rb - About 5 hrs to fix

    File benchi.rb has 344 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_relative '../lib/Ruiby'
    require 'timeout'
    
    $global=binding
    class Test ; def self.test() 1  end ; end
    Severity: Minor
    Found in samples/benchi.rb - About 4 hrs to fix

      Method component has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def component()
          stack do
          #------------ title + entry
          stacki do
            flow do
      Severity: Major
      Found in samples/benchi.rb - About 3 hrs to fix

        Method bench has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def bench(code)
             begin
                eval( "class Test ; def self.test()  #{([code]*100).join(" ; ")} ;  end ; end ",$global)
                __i=0
                istep=100 # number of Test.test() in the while()
        Severity: Minor
        Found in samples/benchi.rb - About 55 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

        There are no issues that match your filters.

        Category
        Status