YorickPeterse/ruby-lint

View on GitHub
lib/ruby-lint/definitions/core/name_error.rb

Summary

Maintainability
A
25 mins
Test Coverage

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

  defs.define_constant('NameError') do |klass|
    klass.inherits(defs.constant_proxy('StandardError', RubyLint.registry))

    klass.define_instance_method('initialize') do |method|
      method.define_rest_argument('args')
Severity: Major
Found in lib/ruby-lint/definitions/core/name_error.rb and 16 other locations - About 25 mins to fix
lib/ruby-lint/definitions/core/drb.rb on lines 291..300
lib/ruby-lint/definitions/core/socket.rb on lines 2967..2976
lib/ruby-lint/definitions/core/socket.rb on lines 3018..3027
lib/ruby-lint/definitions/core/socket.rb on lines 3069..3078
lib/ruby-lint/definitions/gems/celluloid.rb on lines 1534..1543
lib/ruby-lint/definitions/gems/celluloid.rb on lines 2790..2799
lib/ruby-lint/definitions/gems/devise.rb on lines 1733..1742
lib/ruby-lint/definitions/gems/test.rb on lines 593..602
lib/ruby-lint/definitions/gems/test.rb on lines 677..686
lib/ruby-lint/definitions/rails/action_controller.rb on lines 1872..1881
lib/ruby-lint/definitions/rails/action_controller.rb on lines 3422..3431
lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 1528..1537
lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 1625..1634
lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 1643..1652
lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 1878..1887
lib/ruby-lint/definitions/rails/active_record.rb on lines 11653..11662

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

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