YorickPeterse/ruby-lint

View on GitHub

Showing 2,162 of 2,162 total issues

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

  defs.define_constant('Nokogiri::XSLT') do |klass|
    klass.inherits(defs.constant_proxy('Object', RubyLint.registry))

    klass.define_method('parse') do |method|
      method.define_argument('string')
Severity: Minor
Found in lib/ruby-lint/definitions/gems/nokogiri.rb and 1 other location - About 35 mins to fix
lib/ruby-lint/definitions/gems/mongoid.rb on lines 4017..4029

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

  defs.define_constant('Mongoid::Validatable::ClassMethods') do |klass|
    klass.inherits(defs.constant_proxy('Object', RubyLint.registry))

    klass.define_instance_method('validates_relation') do |method|
      method.define_argument('metadata')
Severity: Minor
Found in lib/ruby-lint/definitions/gems/mongoid.rb and 2 other locations - About 35 mins to fix
lib/ruby-lint/definitions/core/gem.rb on lines 1931..1943
lib/ruby-lint/definitions/gems/celluloid.rb on lines 893..905

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 2 locations. Consider refactoring.
Open

  defs.define_constant('Mongoid::Sessions::StorageOptions::ClassMethods') do |klass|
    klass.inherits(defs.constant_proxy('Object', RubyLint.registry))

    klass.define_instance_method('collection_name')

Severity: Minor
Found in lib/ruby-lint/definitions/gems/mongoid.rb and 1 other location - About 35 mins to fix
lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 2520..2534

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

Method iterate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def iterate(node)
      return unless node.is_a?(AST::Node)

      before    = :"on_#{node.type}"
      after     = :"after_#{node.type}"
Severity: Minor
Found in lib/ruby-lint/iterator.rb - About 35 mins to fix

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 7 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(options = {})
      @debug = false

      options.each do |key, value|
        setter = "#{key}="
Severity: Minor
Found in lib/ruby-lint/configuration.rb - About 35 mins to fix

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 generate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def generate
      constants = inspector.inspect_constants(
        inspector.constant,
        options[:ignore].dup
      )
Severity: Minor
Found in lib/ruby-lint/definition_generator.rb - About 35 mins to fix

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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(options = {})
        @inherit_self = true

        options.each do |key, value|
          instance_variable_set("@#{key}", value)
Severity: Minor
Found in lib/ruby-lint/definition/ruby_object.rb - About 35 mins to fix

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 resolve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve(scope)
      current = scope

      constant_segments.each_with_index do |(type, name), index|
        type  = REMAP_TYPES.fetch(type, type)
Severity: Minor
Found in lib/ruby-lint/constant_path.rb - About 35 mins to fix

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 load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def load(constant)
        return if include?(constant)

        filename = file_for_constant(constant)

Severity: Minor
Found in lib/ruby-lint/definition/registry.rb - About 35 mins to fix

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 7 locations. Consider refactoring.
Open

  defs.define_constant('ActiveRecord::SchemaMigration::ExclusionValidator') do |klass|
    klass.inherits(defs.constant_proxy('ActiveModel::EachValidator', RubyLint.registry))
    klass.inherits(defs.constant_proxy('ActiveModel::Validations::Clusivity', RubyLint.registry))

    klass.define_instance_method('validate_each') do |method|
Severity: Major
Found in lib/ruby-lint/definitions/rails/active_record.rb and 6 other locations - About 35 mins to fix
lib/ruby-lint/definitions/gems/mongoid.rb on lines 8927..8934
lib/ruby-lint/definitions/rails/active_model.rb on lines 1337..1344
lib/ruby-lint/definitions/rails/active_model.rb on lines 1409..1416
lib/ruby-lint/definitions/rails/active_record.rb on lines 2431..2438
lib/ruby-lint/definitions/rails/active_record.rb on lines 2581..2588
lib/ruby-lint/definitions/rails/active_record.rb on lines 10231..10238

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

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 7 locations. Consider refactoring.
Open

  defs.define_constant('ActiveModel::Validations::ExclusionValidator') do |klass|
    klass.inherits(defs.constant_proxy('ActiveModel::EachValidator', RubyLint.registry))
    klass.inherits(defs.constant_proxy('ActiveModel::Validations::Clusivity', RubyLint.registry))

    klass.define_instance_method('validate_each') do |method|
Severity: Major
Found in lib/ruby-lint/definitions/rails/active_model.rb and 6 other locations - About 35 mins to fix
lib/ruby-lint/definitions/gems/mongoid.rb on lines 8927..8934
lib/ruby-lint/definitions/rails/active_model.rb on lines 1409..1416
lib/ruby-lint/definitions/rails/active_record.rb on lines 2431..2438
lib/ruby-lint/definitions/rails/active_record.rb on lines 2581..2588
lib/ruby-lint/definitions/rails/active_record.rb on lines 10076..10083
lib/ruby-lint/definitions/rails/active_record.rb on lines 10231..10238

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

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 7 locations. Consider refactoring.
Open

  defs.define_constant('ActiveModel::Validations::InclusionValidator') do |klass|
    klass.inherits(defs.constant_proxy('ActiveModel::EachValidator', RubyLint.registry))
    klass.inherits(defs.constant_proxy('ActiveModel::Validations::Clusivity', RubyLint.registry))

    klass.define_instance_method('validate_each') do |method|
Severity: Major
Found in lib/ruby-lint/definitions/rails/active_model.rb and 6 other locations - About 35 mins to fix
lib/ruby-lint/definitions/gems/mongoid.rb on lines 8927..8934
lib/ruby-lint/definitions/rails/active_model.rb on lines 1337..1344
lib/ruby-lint/definitions/rails/active_record.rb on lines 2431..2438
lib/ruby-lint/definitions/rails/active_record.rb on lines 2581..2588
lib/ruby-lint/definitions/rails/active_record.rb on lines 10076..10083
lib/ruby-lint/definitions/rails/active_record.rb on lines 10231..10238

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

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 7 locations. Consider refactoring.
Open

  defs.define_constant('ActiveRecord::Base::InclusionValidator') do |klass|
    klass.inherits(defs.constant_proxy('ActiveModel::EachValidator', RubyLint.registry))
    klass.inherits(defs.constant_proxy('ActiveModel::Validations::Clusivity', RubyLint.registry))

    klass.define_instance_method('validate_each') do |method|
Severity: Major
Found in lib/ruby-lint/definitions/rails/active_record.rb and 6 other locations - About 35 mins to fix
lib/ruby-lint/definitions/gems/mongoid.rb on lines 8927..8934
lib/ruby-lint/definitions/rails/active_model.rb on lines 1337..1344
lib/ruby-lint/definitions/rails/active_model.rb on lines 1409..1416
lib/ruby-lint/definitions/rails/active_record.rb on lines 2431..2438
lib/ruby-lint/definitions/rails/active_record.rb on lines 10076..10083
lib/ruby-lint/definitions/rails/active_record.rb on lines 10231..10238

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

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

  defs.define_constant('Singleton') do |klass|
    klass.inherits(defs.constant_proxy('Object', RubyLint.registry))

    klass.define_method('__init__') do |method|
      method.define_argument('klass')
Severity: Minor
Found in lib/ruby-lint/definitions/core/singleton.rb and 2 other locations - About 35 mins to fix
lib/ruby-lint/definitions/core/pp.rb on lines 98..111
lib/ruby-lint/definitions/core/profiler__.rb on lines 7..20

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

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 7 locations. Consider refactoring.
Open

  defs.define_constant('Mongoid::Validatable::UniquenessValidator') do |klass|
    klass.inherits(defs.constant_proxy('ActiveModel::EachValidator', RubyLint.registry))
    klass.inherits(defs.constant_proxy('Mongoid::Validatable::Queryable', RubyLint.registry))

    klass.define_instance_method('validate_each') do |method|
Severity: Major
Found in lib/ruby-lint/definitions/gems/mongoid.rb and 6 other locations - About 35 mins to fix
lib/ruby-lint/definitions/rails/active_model.rb on lines 1337..1344
lib/ruby-lint/definitions/rails/active_model.rb on lines 1409..1416
lib/ruby-lint/definitions/rails/active_record.rb on lines 2431..2438
lib/ruby-lint/definitions/rails/active_record.rb on lines 2581..2588
lib/ruby-lint/definitions/rails/active_record.rb on lines 10076..10083
lib/ruby-lint/definitions/rails/active_record.rb on lines 10231..10238

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

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

  defs.define_constant('ActionDispatch') do |klass|
    klass.inherits(defs.constant_proxy('Object', RubyLint.registry))

    klass.define_method('test_app')

Severity: Minor
Found in lib/ruby-lint/definitions/rails/action_dispatch.rb and 2 other locations - About 35 mins to fix
lib/ruby-lint/definitions/gems/gtk.rb on lines 642..654
lib/ruby-lint/definitions/rails/active_support.rb on lines 5129..5141

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

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 7 locations. Consider refactoring.
Open

  defs.define_constant('ActiveRecord::Base::ExclusionValidator') do |klass|
    klass.inherits(defs.constant_proxy('ActiveModel::EachValidator', RubyLint.registry))
    klass.inherits(defs.constant_proxy('ActiveModel::Validations::Clusivity', RubyLint.registry))

    klass.define_instance_method('validate_each') do |method|
Severity: Major
Found in lib/ruby-lint/definitions/rails/active_record.rb and 6 other locations - About 35 mins to fix
lib/ruby-lint/definitions/gems/mongoid.rb on lines 8927..8934
lib/ruby-lint/definitions/rails/active_model.rb on lines 1337..1344
lib/ruby-lint/definitions/rails/active_model.rb on lines 1409..1416
lib/ruby-lint/definitions/rails/active_record.rb on lines 2581..2588
lib/ruby-lint/definitions/rails/active_record.rb on lines 10076..10083
lib/ruby-lint/definitions/rails/active_record.rb on lines 10231..10238

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

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 7 locations. Consider refactoring.
Open

  defs.define_constant('ActiveRecord::SchemaMigration::InclusionValidator') do |klass|
    klass.inherits(defs.constant_proxy('ActiveModel::EachValidator', RubyLint.registry))
    klass.inherits(defs.constant_proxy('ActiveModel::Validations::Clusivity', RubyLint.registry))

    klass.define_instance_method('validate_each') do |method|
Severity: Major
Found in lib/ruby-lint/definitions/rails/active_record.rb and 6 other locations - About 35 mins to fix
lib/ruby-lint/definitions/gems/mongoid.rb on lines 8927..8934
lib/ruby-lint/definitions/rails/active_model.rb on lines 1337..1344
lib/ruby-lint/definitions/rails/active_model.rb on lines 1409..1416
lib/ruby-lint/definitions/rails/active_record.rb on lines 2431..2438
lib/ruby-lint/definitions/rails/active_record.rb on lines 2581..2588
lib/ruby-lint/definitions/rails/active_record.rb on lines 10076..10083

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

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

  defs.define_constant('ActiveSupport::Testing::Isolation') do |klass|
    klass.inherits(defs.constant_proxy('Object', RubyLint.registry))

    klass.define_method('forking_env?')

Severity: Minor
Found in lib/ruby-lint/definitions/rails/active_support.rb and 2 other locations - About 35 mins to fix
lib/ruby-lint/definitions/gems/gtk.rb on lines 642..654
lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 7..19

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

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 2 locations. Consider refactoring.
Open

  defs.define_constant('ActiveRecord::Base::Attribute') do |klass|
    klass.inherits(defs.constant_proxy('Object', RubyLint.registry))

    klass.define_instance_method('serialize')

Severity: Minor
Found in lib/ruby-lint/definitions/rails/active_record.rb and 1 other location - About 35 mins to fix
lib/ruby-lint/definitions/rails/active_record.rb on lines 9531..9543

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

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

Severity
Category
Status
Source
Language