Showing 401 of 401 total issues
Method paint_self
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def paint_self(paint_event)
@painting = true
unless container?
calculate_paint_args!
@original_gc_properties = {} # this stores GC properties before making calls to updates TODO avoid using in pixel graphics
- 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 meta_sample.rb
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'glimmer-dsl-swt'
require 'fileutils'
require 'yaml'
require 'net/http'
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
Class Scaffold
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Scaffold
class << self
include FileUtils
VERSION = File.read(File.expand_path('../../../../VERSION', __FILE__)).strip
Class Tetromino
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Tetromino
ORIENTATIONS = [:north, :east, :south, :west]
LETTER_COLORS = {
I: :cyan,
Method custom_shell_file
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def custom_shell_file(custom_shell_name, namespace, shell_type, shell_options = {})
namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
custom_shell_file_content = <<-MULTI_LINE_STRING
#{namespace_type} #{class_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 initialize
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def initialize(keyword, *args, swt_dialog: nil)
DisplayProxy.instance.auto_exec do
dialog_class = self.class.dialog_class(keyword)
if swt_dialog
@swt_dialog = swt_dialog
- 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 delegate_observation_request_to_radios
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def delegate_observation_request_to_radios(observation_request, &block)
if observation_request != 'on_widget_disposed'
radios.count.times do |index|
radio = radios[index]
label = labels[index]
- 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 calculate_paint_args!
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def calculate_paint_args!
unless @calculated_paint_args
if @name == 'pixel'
@name = 'point'
# optimized performance calculation for pixel points
- 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 setup_shape_painting
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def setup_shape_painting
# TODO consider performance optimization relating to order of shape rendering (affecting only further shapes not previous ones)
if @paint_listener_proxy.nil?
shape_painter = lambda do |paint_event|
shape_painting_work = lambda do |paint_event|
- 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_property_arg_conversions
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_property_arg_conversions(property, args)
method_name = attribute_setter(property)
args = args.dup
the_java_method = org.eclipse.swt.graphics.GC.java_class.declared_instance_methods.detect {|m| m.name == method_name}
return args if the_java_method.nil?
Method calculate_args!
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calculate_args!
return @args if parent.is_a?(Drawable) && !default_x? && !default_y? && !default_width? && !default_height? && !max_width? && !max_height?
calculated_args_dependencies = [
x,
y,
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
File custom_widget.rb
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'glimmer'
require 'glimmer/ui'
require 'glimmer/error'
require 'glimmer/swt/swt_proxy'
require 'glimmer/swt/display_proxy'
Method edit_tree_item
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def edit_tree_item(tree_item, before_write: nil, after_write: nil, after_cancel: nil)
return if tree_item.nil?
content {
@tree_editor_text_proxy = text {
focus true
- 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
new(Time.new(2037, 10, 6, 12, 0), 'New York Yankees', 'Boston Red Sox', 'Free Bobblehead'),
new(Time.new(2037, 10, 7, 12, 0), 'New York Yankees', 'Boston Red Sox'),
new(Time.new(2037, 10, 8, 12, 0), 'Boston Red Sox', 'New York Yankees'),
new(Time.new(2037, 10, 9, 12, 0), 'Boston Red Sox', 'New York Yankees'),
new(Time.new(2037, 10, 10, 12, 0), 'Boston Red Sox', 'New York Yankees', 'Free Umbrella'),
- 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 105.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
new(Time.new(2037, 10, 6, 12, 0), 'Chicago Cubs', 'Milwaukee Brewers', 'Free Bobblehead'),
new(Time.new(2037, 10, 7, 12, 0), 'Chicago Cubs', 'Milwaukee Brewers'),
new(Time.new(2037, 10, 8, 12, 0), 'Milwaukee Brewers', 'Chicago Cubs'),
new(Time.new(2037, 10, 9, 12, 0), 'Milwaukee Brewers', 'Chicago Cubs'),
new(Time.new(2037, 10, 10, 12, 0), 'Milwaukee Brewers', 'Chicago Cubs', 'Free Umbrella'),
- 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 105.
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
Method edit_table_item
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
def edit_table_item(table_item, column_index, before_write: nil, after_write: nil, after_cancel: nil, write_on_cancel: false)
return if table_item.nil?
model = table_item.data
property = column_properties[column_index]
cancel_edit!
Class Line
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Line < Shape
include PathSegment
class << self
def include?(x1, y1, x2, y2, x, y)