raubarede/Ruiby

View on GitHub
samples/gadget.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method expose has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def expose(cv,ctx)
    ssize=cv.get_size_request()
    ############## Liste
    @cv.draw_rectangle(0,0,ssize.first,ssize.last,0,nil,"#888",0)
    @cv.draw_rectangle(2,2,ssize.first-4,ssize.last-4,15,"#555",$BG,3)
Severity: Minor
Found in samples/gadget.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 expose has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def expose(cv,ctx)
    ssize=cv.get_size_request()
    ############## Liste
    @cv.draw_rectangle(0,0,ssize.first,ssize.last,0,nil,"#888",0)
    @cv.draw_rectangle(2,2,ssize.first-4,ssize.last-4,15,"#555",$BG,3)
Severity: Minor
Found in samples/gadget.rb - About 1 hr to fix

    Method get_update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_update()
        Thread.new {
          begin
            @lv=get_data
            gui_invoke { @cv.redraw rescue p $!}
    Severity: Minor
    Found in samples/gadget.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 get_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_data()
     start=Time.now
     if $lexclude.size==0
       $lexclude=Hash[*Gems.most_downloaded.map {|a| 
          [a.first['full_name'].split('-').first.gsub('_',' '),1]
    Severity: Minor
    Found in samples/gadget.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

    There are no issues that match your filters.

    Category
    Status