AndyObtiva/glimmer-dsl-swt

View on GitHub
samples/hello/hello_canvas_data_binding.rb

Summary

Maintainability
D
2 days
Test Coverage

File hello_canvas_data_binding.rb has 770 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'glimmer-dsl-swt'

class HelloCanvasDataBinding
  class PathShape
    attr_accessor :foreground_red, :foreground_green, :foreground_blue, :line_width_value, :line_style_value
Severity: Major
Found in samples/hello/hello_canvas_data_binding.rb - About 1 day to fix

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

                @cubic_oval4 = oval {
                  x          <= [@cubic, :x2_value, on_read: ->(val) {val - 5}]
                  y          <= [@cubic, :y2_value, on_read: ->(val) {val - 5}]
                  width 10
                  height 10
    Severity: Major
    Found in samples/hello/hello_canvas_data_binding.rb and 8 other locations - About 35 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 267..273
    samples/hello/hello_canvas_data_binding.rb on lines 275..281
    samples/hello/hello_canvas_data_binding.rb on lines 509..515
    samples/hello/hello_canvas_data_binding.rb on lines 517..523
    samples/hello/hello_canvas_data_binding.rb on lines 525..531
    samples/hello/hello_canvas_data_binding.rb on lines 792..798
    samples/hello/hello_canvas_data_binding.rb on lines 800..806
    samples/hello/hello_canvas_data_binding.rb on lines 808..814

    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 36.

    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

    Further Reading

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

                @quad_oval2 = oval {
                  x          <= [@quad, :cx_value, on_read: ->(val) {val - 5}]
                  y          <= [@quad, :cy_value, on_read: ->(val) {val - 5}]
                  width 10
                  height 10
    Severity: Major
    Found in samples/hello/hello_canvas_data_binding.rb and 8 other locations - About 35 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 267..273
    samples/hello/hello_canvas_data_binding.rb on lines 275..281
    samples/hello/hello_canvas_data_binding.rb on lines 509..515
    samples/hello/hello_canvas_data_binding.rb on lines 525..531
    samples/hello/hello_canvas_data_binding.rb on lines 792..798
    samples/hello/hello_canvas_data_binding.rb on lines 800..806
    samples/hello/hello_canvas_data_binding.rb on lines 808..814
    samples/hello/hello_canvas_data_binding.rb on lines 816..822

    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 36.

    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

    Further Reading

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

                @quad_oval1 = oval {
                  x          <= [@quad, :x1_value, on_read: ->(val) {val - 5}]
                  y          <= [@quad, :y1_value, on_read: ->(val) {val - 5}]
                  width 10
                  height 10
    Severity: Major
    Found in samples/hello/hello_canvas_data_binding.rb and 8 other locations - About 35 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 267..273
    samples/hello/hello_canvas_data_binding.rb on lines 275..281
    samples/hello/hello_canvas_data_binding.rb on lines 517..523
    samples/hello/hello_canvas_data_binding.rb on lines 525..531
    samples/hello/hello_canvas_data_binding.rb on lines 792..798
    samples/hello/hello_canvas_data_binding.rb on lines 800..806
    samples/hello/hello_canvas_data_binding.rb on lines 808..814
    samples/hello/hello_canvas_data_binding.rb on lines 816..822

    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 36.

    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

    Further Reading

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

                @cubic_oval2 = oval {
                  x          <= [@cubic, :cx1_value, on_read: ->(val) {val - 5}]
                  y          <= [@cubic, :cy1_value, on_read: ->(val) {val - 5}]
                  width 10
                  height 10
    Severity: Major
    Found in samples/hello/hello_canvas_data_binding.rb and 8 other locations - About 35 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 267..273
    samples/hello/hello_canvas_data_binding.rb on lines 275..281
    samples/hello/hello_canvas_data_binding.rb on lines 509..515
    samples/hello/hello_canvas_data_binding.rb on lines 517..523
    samples/hello/hello_canvas_data_binding.rb on lines 525..531
    samples/hello/hello_canvas_data_binding.rb on lines 792..798
    samples/hello/hello_canvas_data_binding.rb on lines 808..814
    samples/hello/hello_canvas_data_binding.rb on lines 816..822

    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 36.

    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

    Further Reading

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

                @cubic_oval1 = oval {
                  x          <= [@cubic, :x1_value, on_read: ->(val) {val - 5}]
                  y          <= [@cubic, :y1_value, on_read: ->(val) {val - 5}]
                  width 10
                  height 10
    Severity: Major
    Found in samples/hello/hello_canvas_data_binding.rb and 8 other locations - About 35 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 267..273
    samples/hello/hello_canvas_data_binding.rb on lines 275..281
    samples/hello/hello_canvas_data_binding.rb on lines 509..515
    samples/hello/hello_canvas_data_binding.rb on lines 517..523
    samples/hello/hello_canvas_data_binding.rb on lines 525..531
    samples/hello/hello_canvas_data_binding.rb on lines 800..806
    samples/hello/hello_canvas_data_binding.rb on lines 808..814
    samples/hello/hello_canvas_data_binding.rb on lines 816..822

    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 36.

    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

    Further Reading

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

                @line_oval1 = oval {
                  x          <= [@line, :x1_value, on_read: ->(val) {val - 5}]
                  y          <= [@line, :y1_value, on_read: ->(val) {val - 5}]
                  width 10
                  height 10
    Severity: Major
    Found in samples/hello/hello_canvas_data_binding.rb and 8 other locations - About 35 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 275..281
    samples/hello/hello_canvas_data_binding.rb on lines 509..515
    samples/hello/hello_canvas_data_binding.rb on lines 517..523
    samples/hello/hello_canvas_data_binding.rb on lines 525..531
    samples/hello/hello_canvas_data_binding.rb on lines 792..798
    samples/hello/hello_canvas_data_binding.rb on lines 800..806
    samples/hello/hello_canvas_data_binding.rb on lines 808..814
    samples/hello/hello_canvas_data_binding.rb on lines 816..822

    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 36.

    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

    Further Reading

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

                @line_oval2 = oval {
                  x          <= [@line, :x2_value, on_read: ->(val) {val - 5}]
                  y          <= [@line, :y2_value, on_read: ->(val) {val - 5}]
                  width 10
                  height 10
    Severity: Major
    Found in samples/hello/hello_canvas_data_binding.rb and 8 other locations - About 35 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 267..273
    samples/hello/hello_canvas_data_binding.rb on lines 509..515
    samples/hello/hello_canvas_data_binding.rb on lines 517..523
    samples/hello/hello_canvas_data_binding.rb on lines 525..531
    samples/hello/hello_canvas_data_binding.rb on lines 792..798
    samples/hello/hello_canvas_data_binding.rb on lines 800..806
    samples/hello/hello_canvas_data_binding.rb on lines 808..814
    samples/hello/hello_canvas_data_binding.rb on lines 816..822

    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 36.

    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

    Further Reading

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

                @quad_oval3 = oval {
                  x          <= [@quad, :x2_value, on_read: ->(val) {val - 5}]
                  y          <= [@quad, :y2_value, on_read: ->(val) {val - 5}]
                  width 10
                  height 10
    Severity: Major
    Found in samples/hello/hello_canvas_data_binding.rb and 8 other locations - About 35 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 267..273
    samples/hello/hello_canvas_data_binding.rb on lines 275..281
    samples/hello/hello_canvas_data_binding.rb on lines 509..515
    samples/hello/hello_canvas_data_binding.rb on lines 517..523
    samples/hello/hello_canvas_data_binding.rb on lines 792..798
    samples/hello/hello_canvas_data_binding.rb on lines 800..806
    samples/hello/hello_canvas_data_binding.rb on lines 808..814
    samples/hello/hello_canvas_data_binding.rb on lines 816..822

    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 36.

    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

    Further Reading

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

                @cubic_oval3 = oval {
                  x          <= [@cubic, :cx2_value, on_read: ->(val) {val - 5}]
                  y          <= [@cubic, :cy2_value, on_read: ->(val) {val - 5}]
                  width 10
                  height 10
    Severity: Major
    Found in samples/hello/hello_canvas_data_binding.rb and 8 other locations - About 35 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 267..273
    samples/hello/hello_canvas_data_binding.rb on lines 275..281
    samples/hello/hello_canvas_data_binding.rb on lines 509..515
    samples/hello/hello_canvas_data_binding.rb on lines 517..523
    samples/hello/hello_canvas_data_binding.rb on lines 525..531
    samples/hello/hello_canvas_data_binding.rb on lines 792..798
    samples/hello/hello_canvas_data_binding.rb on lines 800..806
    samples/hello/hello_canvas_data_binding.rb on lines 816..822

    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 36.

    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

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

                on_mouse_down do |mouse_event|
                  @selected_shape = @line_canvas.shape_at_location(mouse_event.x, mouse_event.y)
                  @selected_shape = nil unless @selected_shape.is_a?(Glimmer::SWT::Custom::Shape::Oval)
                  @line_canvas.cursor = :hand if @selected_shape
    Severity: Minor
    Found in samples/hello/hello_canvas_data_binding.rb and 2 other locations - About 15 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 533..536
    samples/hello/hello_canvas_data_binding.rb on lines 824..827

    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 26.

    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

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

                on_mouse_down do |mouse_event|
                  @selected_shape = @cubic_canvas.shape_at_location(mouse_event.x, mouse_event.y)
                  @selected_shape = nil unless @selected_shape.is_a?(Glimmer::SWT::Custom::Shape::Oval)
                  @cubic_canvas.cursor = :hand if @selected_shape
    Severity: Minor
    Found in samples/hello/hello_canvas_data_binding.rb and 2 other locations - About 15 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 283..286
    samples/hello/hello_canvas_data_binding.rb on lines 533..536

    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 26.

    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

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

                on_mouse_down do |mouse_event|
                  @selected_shape = @quad_canvas.shape_at_location(mouse_event.x, mouse_event.y)
                  @selected_shape = nil unless @selected_shape.is_a?(Glimmer::SWT::Custom::Shape::Oval)
                  @quad_canvas.cursor = :hand if @selected_shape
    Severity: Minor
    Found in samples/hello/hello_canvas_data_binding.rb and 2 other locations - About 15 mins to fix
    samples/hello/hello_canvas_data_binding.rb on lines 283..286
    samples/hello/hello_canvas_data_binding.rb on lines 824..827

    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 26.

    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

    Further Reading

    There are no issues that match your filters.

    Category
    Status