AndyObtiva/glimmer-dsl-tk

View on GitHub
lib/glimmer/tk/menu_item_proxy.rb

Summary

Maintainability
C
1 day
Test Coverage

Class MenuItemProxy has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

    class MenuItemProxy < WidgetProxy
      ACCELERATOR_MODIFIER_EVENT_MAP = {
        'Command' => 'Command',
        'Cmd' => 'Command',
        'Meta' => 'Command',
Severity: Minor
Found in lib/glimmer/tk/menu_item_proxy.rb - About 3 hrs to fix

    Method build_widget has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

          def build_widget
            @args.prepend(:command) if @args.first.is_a?(Hash)
            @args.append({}) if !@args.last.is_a?(Hash)
            @args.last.merge!(variable: variable, value: label) if radiobutton? || checkbutton?
            case @parent_proxy
    Severity: Minor
    Found in lib/glimmer/tk/menu_item_proxy.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 configure_menu_item_attribute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def configure_menu_item_attribute(attribute_value_hash)
            if preferences? && attribute_value_hash[:command]
              ::Tk.ip_eval("proc ::tk::mac::ShowPreferences {} {#{::Tk.install_cmd(attribute_value_hash[:command])}}") if OS.mac?
            elsif help? && attribute_value_hash[:command]
              ::Tk.ip_eval("proc ::tk::mac::ShowHelp {} {#{::Tk.install_cmd(attribute_value_hash[:command])}}") if OS.mac?
    Severity: Minor
    Found in lib/glimmer/tk/menu_item_proxy.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

    Avoid deeply nested control flow statements.
    Open

                self.value = variable.value = attribute_value_hash.values.first if variable.value == @last_label
    Severity: Major
    Found in lib/glimmer/tk/menu_item_proxy.rb - About 45 mins to fix

      Method variable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def variable(auto_create: true)
              if @variable.nil? && auto_create
                sibling_variable = sibling_radio_menu_items.map {|mi| mi.variable(auto_create: false)}.compact.first
                @variable = sibling_variable.nil? ? ::TkVariable.new : sibling_variable
              else
      Severity: Minor
      Found in lib/glimmer/tk/menu_item_proxy.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