Showing 401 of 401 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
def evaluate_vertical_win
connections = nil
last_slot_value = nil
WIDTH.times do |column_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
Similar blocks of code found in 2 locations. Consider refactoring. Open
class HelloFileDialog
include Glimmer::UI::CustomShell
attr_accessor :selected_file
- 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 61.
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
def custom_widget(custom_widget_name, namespace)
namespace ||= current_dir_name
root_dir = File.exists?('app') ? 'app' : 'lib'
parent_dir = "#{root_dir}/#{file_name(namespace)}/view"
return puts("The file '#{parent_dir}/#{file_name(custom_widget_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_widget_name)}.rb")
- 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 61.
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
class HelloDirectoryDialog
include Glimmer::UI::CustomShell
attr_accessor :selected_directory
- 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 61.
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
def custom_shape(custom_shape_name, namespace)
namespace ||= current_dir_name
root_dir = File.exists?('app') ? 'app' : 'lib'
parent_dir = "#{root_dir}/#{file_name(namespace)}/view"
return puts("The file '#{parent_dir}/#{file_name(custom_shape_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_shape_name)}.rb")
- 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 61.
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 initialize
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(*args, &content)
@args = args
@parent_proxy = nil
if @args.first.is_a?(WidgetProxy)
@parent_proxy = @args.shift
Method parking_spot
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parking_spot(location_x, location_y, length, angle)
parking_spot_letter = next_parking_spot_letter
height = length
width = (2.0/3)*length
Method default_blocks
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def default_blocks
case @letter
when :I
[
[block, block, block, block]
Method find_listener
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.find_listener(swt_widget_class, underscored_listener_name)
@listeners ||= {}
listener_key = [swt_widget_class.name, underscored_listener_name]
unless @listeners.has_key?(listener_key)
listener_method_name = underscored_listener_name.camelcase(:lower)
- 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 set_attribute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def set_attribute(attribute_name, *args)
# TODO consider refactoring/unifying this code with WidgetProxy and elsewhere
if args.count == 1
if args.first.is_a?(Symbol) || args.first.is_a?(String)
args[0] = ColorProxy.new(args.first).swt_color
- 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 []
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def [](*symbols)
symbols = symbols.first if symbols.size == 1 && symbols.first.is_a?(Array)
result = symbols.compact.map do |symbol|
constant(symbol).tap do |constant_value|
raise Glimmer::Error, symbol.to_s + error_message_invalid_style unless constant_value.is_a?(Integer)
- 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_widget_class_for
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.swt_widget_class_for(underscored_widget_name)
# TODO clear memoization for a keyword if a custom widget was defined with that keyword
unless flyweight_swt_widget_classes.keys.include?(underscored_widget_name)
begin
underscored_widget_name = KEYWORD_ALIASES[underscored_widget_name] if KEYWORD_ALIASES[underscored_widget_name]
- 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 start_moving_tetrominos_down
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def start_moving_tetrominos_down
Thread.new do
@mutex.synchronize do
loop do
time = Time.now
- 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 35 lines of code (exceeds 25 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)}"
Method custom_shape_gem
has 35 lines of code (exceeds 25 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)}"
Method sort!
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sort!(internal_sort: false)
return unless sort_property && (sort_type || sort_block || sort_by_block)
if sort_strategy
sort_strategy.call
else
Method build_radios
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_radios
current_selection = selection
@composites.to_a.each(&:dispose)
@radios = []
@labels = []
Method initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(parent, args)
index = args.delete(args.last) if args.last.is_a?(Numeric)
styles = args.map(&:to_sym)
if !styles.include?(:bar) && !parent.swt_widget.is_a?(Menu)
styles = styles.unshift(:pop_up)
Method all
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def all
@all ||= [
{town: 'Chicago', name: 'White Sox', ballpark: 'Guaranteed Rate Field'},
{town: 'Cleveland', name: 'Indians', ballpark: 'Progressive Field'},
{town: 'Detroit', name: 'Tigers', ballpark: 'Comerica Park'},
Method initialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def initialize(parent, *args, options, &content)
SWT::DisplayProxy.current_custom_widgets_and_shapes << self
@parent_proxy = @parent = parent
@parent_proxy = @parent&.get_data('proxy') if @parent.respond_to?(:get_data) && @parent.get_data('proxy')
@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"