Showing 401 of 401 total issues
Method initialize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def initialize(underscored_layout_name, widget_proxy, args)
DisplayProxy.instance.auto_exec do
@underscored_layout_name = underscored_layout_name
@widget_proxy = widget_proxy
args = SWTProxy.constantify_args(args)
- 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 swt_color
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def swt_color
unless @swt_color
case @args.size
when 1
if @args.first.is_a?(String) || @args.first.is_a?(Symbol)
- 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 build_checkboxes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def build_checkboxes
current_selection = selection
@composites.to_a.each(&:dispose)
@checkboxes = []
@labels = []
- 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 draw_frame
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def draw_frame(start_number)
if stopped? or
(start_number != @start_number) or
(frame_count_limited? && @frame_index == @frame_count) or
(cycle_limited? && @cycle_count_index == @cycle_count) or
Method timer_menu_bar
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def timer_menu_bar
menu_bar {
menu {
text '&Action'
Method sort_by_column!
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sort_by_column!(table_column_proxy=nil)
index = nil
auto_exec do
index = swt_widget.columns.to_a.index(table_column_proxy.swt_widget) unless table_column_proxy.nil?
end
Method native
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def native(native_type=nil, native_extra_args)
puts "Generating native executable with jpackage..."
java_version = `jruby -v`
if java_version.include?(JDK_VERSION)
puts "Java Version #{JDK_VERSION} Detected!"
Method build_checkboxes
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_checkboxes
current_selection = selection
@composites.to_a.each(&:dispose)
@checkboxes = []
@labels = []
Method common_app
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def common_app(app_name, shell_type = :app, shell_options = {})
gem_name = file_name(app_name)
gem_summary = human_name(app_name)
return puts("The directory '#{gem_name}' already exists. Please either remove or pick a different name.") if Dir.exist?(gem_name)
system "jruby -S gem install bundler --no-document" if OS.windows? # resolves freezing issue with warbler and bundler 2.2.29 included in JRuby
- 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 call
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def call(value)
SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @sync_exec, override_async_exec: @async_exec) do
if @widget.respond_to?(:disposed?) && @widget.disposed?
unless @widget.shell_proxy.last_shell_closing?
@widget_proxy.widget_bindings.delete(self)
- 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 initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(widget, property, sync_exec: nil, async_exec: nil)
@widget = widget
@property = property
@sync_exec = sync_exec
@async_exec = async_exec
- 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 evaluate_vertical_win
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def evaluate_vertical_win
connections = nil
last_slot_value = nil
WIDTH.times do |column_index|
connections = nil
- 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 normalized_attribute
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def normalized_attribute(attribute_name)
@normalized_attributes ||= {}
if @normalized_attributes[attribute_name].nil?
attribute_name = attribute_name.to_s if attribute_name.is_a?(Symbol)
attribute_name = attribute_name.underscore unless attribute_name.downcase?
- 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 evaluate_diagonal_win
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def evaluate_diagonal_win(diagonal_coordinates)
connections = nil
last_slot_value = nil
diagonal_coordinates.each do |group|
connections = nil
- 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 evaluate_horizontal_win
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def evaluate_horizontal_win
connections = nil
last_slot_value = nil
HEIGHT.times do |row_index|
connections = nil
- 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 custom_widget_gem
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def custom_widget_gem(custom_widget_name, namespace)
gem_name = "glimmer-cw-#{compact_name(custom_widget_name)}"
gem_summary = "#{human_name(custom_widget_name)} - Glimmer Custom Widget"
if namespace
gem_name += "-#{compact_name(namespace)}"
- 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 custom_shape_gem
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def custom_shape_gem(custom_shape_name, namespace)
gem_name = "glimmer-cp-#{compact_name(custom_shape_name)}"
gem_summary = "#{human_name(custom_shape_name)} - Glimmer Custom Shape"
if namespace
gem_name += "-#{compact_name(namespace)}"
- 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 ensure_extent
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def ensure_extent(paint_event)
old_extent = @extent
old_extent_args = @extent_args
if ['text', 'string'].include?(@name)
extent_args = [string]
- 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 apply_shape_arg_defaults!
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def apply_shape_arg_defaults!
if current_parameter_name?(:dest_x) && dest_x.nil?
self.dest_x = :default
elsif parameter_name?(:x) && x.nil?
self.x = :default
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
def evaluate_horizontal_win
connections = nil
last_slot_value = nil
HEIGHT.times do |row_index|
connections = nil
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 64.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76