Method code_text_widget
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def code_text_widget
@styled_text_proxy = styled_text(@swt_style) {
# custom_widget_property_owner # TODO implement to route properties here without declaring method_missing
layout_data :fill, :fill, true, true if lines
- 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
File code_text.rb
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'glimmer/ui/custom_widget'
module Glimmer
module SWT
module Custom
Method code_text_widget
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
def code_text_widget
@styled_text_proxy = styled_text(@swt_style) {
# custom_widget_property_owner # TODO implement to route properties here without declaring method_missing
layout_data :fill, :fill, true, true if lines
Class CodeText
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class CodeText
include Glimmer::UI::CustomWidget
class << self
def languages
Method method_missing
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(method_name, *args, &block)
dsl_mode = @dsl_mode || args.last.is_a?(Hash) && args.last[:dsl]
if dsl_mode
args.pop if args.last.is_a?(Hash) && args.last[:dsl]
super(method_name, *args, &block)
- 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 respond_to?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def respond_to?(method_name, *args, &block)
dsl_mode = @dsl_mode || args.last.is_a?(Hash) && args.last[:dsl]
if dsl_mode
args = args[0...-1] if args.last.is_a?(Hash) && args.last[:dsl]
super(method_name, *args, &block)
- 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 hex_color_to_swt_color
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def hex_color_to_swt_color(color_data, default_color)
color_data = "##{color_data.chars.drop(1).map {|c| c*2}.join}" if color_data.is_a?(String) && color_data.start_with?('#') && color_data&.size == 4
color_data = color_data.match(REGEX_COLOR_HEX6).to_a.drop(1).map {|c| "0x#{c}".hex}.to_a if color_data.is_a?(String) && color_data.start_with?('#')
color_data = [color_data] unless color_data.nil? || color_data.empty? || color_data.is_a?(Array)
color_data = default_color if color_data.nil? || color_data.empty?
- 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"