raubarede/Ruiby

View on GitHub
samples/pipeplot.rb

Summary

Maintainability
C
1 day
Test Coverage

Method run_window has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def run_window()
    Ruiby.app width: $W, height: $H, title: "Curve" do
    fn=Ruiby::MEDIA+"/famfamfam/chart_curve.png"
    set_icon(fn) if File.exists?(fn)
    set_resizable(true)
Severity: Major
Found in samples/pipeplot.rb - About 3 hrs to fix

    File pipeplot.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_relative '../lib/Ruiby'
    
    #require 'Ruiby'
    
    $bgcolor=Ruiby_dsl.html_color("#023")
    Severity: Minor
    Found in samples/pipeplot.rb - About 2 hrs to fix

      Method run_window has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def run_window()
          Ruiby.app width: $W, height: $H, title: "Curve" do
          fn=Ruiby::MEDIA+"/famfamfam/chart_curve.png"
          set_icon(fn) if File.exists?(fn)
          set_resizable(true)
      Severity: Minor
      Found in samples/pipeplot.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 has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(noc,min,max,label,dxlabel,auto_scale)
      Severity: Minor
      Found in samples/pipeplot.rb - About 45 mins to fix

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

            def register_value(data)
                if data.is_a? Array
                    svalue=data[@noc]
                    return if !svalue || svalue !~ /[\d.]+/
                    @value=svalue.to_f
        Severity: Minor
        Found in samples/pipeplot.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 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def add(noc,y0,y1,label,autoscale)
        Severity: Minor
        Found in samples/pipeplot.rb - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status