raubarede/Ruiby

View on GitHub
lib/ruiby_gtk/editor.rb

Summary

Maintainability
C
7 hrs
Test Coverage

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

    def component()
      stack do
          if ed=source_editor()
            @edit=slot(ed).editor
            @edit.buffer.text=File.exists?(@filename) ? File.read(@filename) : @filename
Severity: Minor
Found in lib/ruiby_gtk/editor.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 component has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def component()
      stack do
        flow {
            stacki { space;_button_list;space } if @options["button-orrient"] =~ /^l/i
            @grid=grid(@captions,100,150)
Severity: Minor
Found in lib/ruiby_gtk/editor.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 _button_list has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _button_list()
        @options.each do |name,action| 
            next unless   action.respond_to?(:call)
            button(name) {
                next unless  @grid.index()
Severity: Minor
Found in lib/ruiby_gtk/editor.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 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(title,width=350,height=600,data={},options={},opt={},&bloc)
Severity: Major
Found in lib/ruiby_gtk/editor.rb - About 50 mins to fix

    Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(title,width=350,height=600,captions=[["oups"]],data=[["no data"]],options={},&bloc)
    Severity: Major
    Found in lib/ruiby_gtk/editor.rb - About 50 mins to fix

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

          def component()
            stack do
              labeli(@title)
              @form=properties("",@data,@popt) { |a| @bloc.call(a) if @bloc }
              case @options["button-direction"] 
      Severity: Minor
      Found in lib/ruiby_gtk/editor.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 button_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def button_list()
              @options.each do |name,action| 
                  next unless   action.respond_to?(:call)
                  button(name) { action.call(@form,@form.get_data() )  rescue  error($!)  }
              end
      Severity: Minor
      Found in lib/ruiby_gtk/editor.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

      There are no issues that match your filters.

      Category
      Status