Class MenuItemProxy
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class MenuItemProxy < WidgetProxy
ACCELERATOR_MODIFIER_EVENT_MAP = {
'Command' => 'Command',
'Cmd' => 'Command',
'Meta' => 'Command',
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
- Read upRead up
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?
- Read upRead up
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
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
- Read upRead up
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"