YorickPeterse/ruby-lint

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

Summary

Maintainability
D
2 days
Test Coverage

File unixserver.rb has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

RubyLint.registry.register('UNIXServer') do |defs|
  defs.define_constant('UNIXServer') do |klass|
    klass.inherits(defs.constant_proxy('UNIXSocket', RubyLint.registry))
    klass.inherits(defs.constant_proxy('Socket::ListenAndAccept', RubyLint.registry))
    klass.inherits(defs.constant_proxy('IO::Socketable', RubyLint.registry))
Severity: Minor
Found in lib/ruby-lint/definitions/core/unixserver.rb - About 4 hrs to fix

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

      defs.define_constant('UNIXServer::InternalBuffer') do |klass|
        klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
    
        klass.define_method('allocate')
    
    
    Severity: Major
    Found in lib/ruby-lint/definitions/core/unixserver.rb and 8 other locations - About 4 hrs to fix
    lib/ruby-lint/definitions/core/basic_socket.rb on lines 323..402
    lib/ruby-lint/definitions/core/file.rb on lines 759..838
    lib/ruby-lint/definitions/core/ipsocket.rb on lines 277..356
    lib/ruby-lint/definitions/core/socket.rb on lines 2279..2358
    lib/ruby-lint/definitions/core/tcpserver.rb on lines 264..343
    lib/ruby-lint/definitions/core/tcpsocket.rb on lines 278..357
    lib/ruby-lint/definitions/core/udpsocket.rb on lines 279..358
    lib/ruby-lint/definitions/core/unixsocket.rb on lines 292..371

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

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

      defs.define_constant('UNIXServer::FFI') do |klass|
        klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
    
        klass.define_method('add_typedef') do |method|
          method.define_argument('current')
    Severity: Major
    Found in lib/ruby-lint/definitions/core/unixserver.rb and 14 other locations - About 2 hrs to fix
    lib/ruby-lint/definitions/core/basic_socket.rb on lines 228..269
    lib/ruby-lint/definitions/core/errno.rb on lines 1960..2001
    lib/ruby-lint/definitions/core/etc.rb on lines 45..86
    lib/ruby-lint/definitions/core/file.rb on lines 659..700
    lib/ruby-lint/definitions/core/float.rb on lines 181..222
    lib/ruby-lint/definitions/core/io.rb on lines 570..611
    lib/ruby-lint/definitions/core/ipsocket.rb on lines 182..223
    lib/ruby-lint/definitions/core/math.rb on lines 133..174
    lib/ruby-lint/definitions/core/process.rb on lines 325..366
    lib/ruby-lint/definitions/core/socket.rb on lines 1550..1591
    lib/ruby-lint/definitions/core/tcpserver.rb on lines 169..210
    lib/ruby-lint/definitions/core/tcpsocket.rb on lines 183..224
    lib/ruby-lint/definitions/core/udpsocket.rb on lines 184..225
    lib/ruby-lint/definitions/core/unixsocket.rb on lines 197..238

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

    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

      defs.define_constant('UNIXServer::BidirectionalPipe') do |klass|
        klass.inherits(defs.constant_proxy('IO', RubyLint.registry))
    
        klass.define_instance_method('<<') do |method|
          method.define_argument('obj')
    Severity: Major
    Found in lib/ruby-lint/definitions/core/unixserver.rb and 8 other locations - About 2 hrs to fix
    lib/ruby-lint/definitions/core/basic_socket.rb on lines 94..139
    lib/ruby-lint/definitions/core/file.rb on lines 355..400
    lib/ruby-lint/definitions/core/ipsocket.rb on lines 48..93
    lib/ruby-lint/definitions/core/socket.rb on lines 226..271
    lib/ruby-lint/definitions/core/tcpserver.rb on lines 35..80
    lib/ruby-lint/definitions/core/tcpsocket.rb on lines 49..94
    lib/ruby-lint/definitions/core/udpsocket.rb on lines 50..95
    lib/ruby-lint/definitions/core/unixsocket.rb on lines 63..108

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

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

      defs.define_constant('UNIXServer::Enumerator') do |klass|
        klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
        klass.inherits(defs.constant_proxy('Enumerable', RubyLint.registry))
    
        klass.define_instance_method('each') do |method|
    Severity: Major
    Found in lib/ruby-lint/definitions/core/unixserver.rb and 179 other locations - About 2 hrs to fix
    lib/ruby-lint/definitions/core/array.rb on lines 382..413
    lib/ruby-lint/definitions/core/basic_socket.rb on lines 188..219
    lib/ruby-lint/definitions/core/cgi.rb on lines 100..131
    lib/ruby-lint/definitions/core/csv.rb on lines 326..357
    lib/ruby-lint/definitions/core/csv.rb on lines 387..418
    lib/ruby-lint/definitions/core/csv.rb on lines 664..695
    lib/ruby-lint/definitions/core/csv.rb on lines 830..861
    lib/ruby-lint/definitions/core/enumerator.rb on lines 7..38
    lib/ruby-lint/definitions/core/file.rb on lines 619..650
    lib/ruby-lint/definitions/core/gem.rb on lines 795..826
    lib/ruby-lint/definitions/core/hash.rb on lines 431..462
    lib/ruby-lint/definitions/core/io.rb on lines 530..561
    lib/ruby-lint/definitions/core/ipsocket.rb on lines 142..173
    lib/ruby-lint/definitions/core/irb.rb on lines 305..336
    lib/ruby-lint/definitions/core/matrix.rb on lines 335..366
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 161..192
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 409..440
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 468..499
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 777..808
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 1186..1217
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 3221..3252
    lib/ruby-lint/definitions/core/option_parser.rb on lines 498..529
    lib/ruby-lint/definitions/core/option_parser.rb on lines 968..999
    lib/ruby-lint/definitions/core/prime.rb on lines 60..91
    lib/ruby-lint/definitions/core/prime.rb on lines 107..138
    lib/ruby-lint/definitions/core/prime.rb on lines 196..227
    lib/ruby-lint/definitions/core/prime.rb on lines 297..328
    lib/ruby-lint/definitions/core/prime.rb on lines 411..442
    lib/ruby-lint/definitions/core/range.rb on lines 102..133
    lib/ruby-lint/definitions/core/set.rb on lines 176..207
    lib/ruby-lint/definitions/core/socket.rb on lines 1510..1541
    lib/ruby-lint/definitions/core/sorted_set.rb on lines 24..55
    lib/ruby-lint/definitions/core/string_io.rb on lines 284..315
    lib/ruby-lint/definitions/core/struct.rb on lines 123..154
    lib/ruby-lint/definitions/core/syck.rb on lines 361..392
    lib/ruby-lint/definitions/core/syck.rb on lines 474..505
    lib/ruby-lint/definitions/core/syck.rb on lines 836..867
    lib/ruby-lint/definitions/core/syck.rb on lines 1138..1169
    lib/ruby-lint/definitions/core/tcpserver.rb on lines 129..160
    lib/ruby-lint/definitions/core/tcpsocket.rb on lines 143..174
    lib/ruby-lint/definitions/core/udpsocket.rb on lines 144..175
    lib/ruby-lint/definitions/core/unixsocket.rb on lines 157..188
    lib/ruby-lint/definitions/core/vector.rb on lines 146..177
    lib/ruby-lint/definitions/core/webrick.rb on lines 510..541
    lib/ruby-lint/definitions/core/zlib.rb on lines 238..269
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 948..979
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 1197..1228
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 1993..2024
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 2460..2491
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 2685..2716
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 2995..3026
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 3214..3245
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 3433..3464
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 3670..3701
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 4001..4032
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 4269..4300
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 4487..4518
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 4768..4799
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 5020..5051
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 5254..5285
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 5844..5875
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 6122..6153
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 6181..6212
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 6767..6798
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 6987..7018
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 7451..7482
    lib/ruby-lint/definitions/rails/action_controller.rb on lines 2117..2148
    lib/ruby-lint/definitions/rails/action_controller.rb on lines 2301..2332
    lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 476..507
    lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 846..877
    lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 1162..1193
    lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 2466..2497
    lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 2720..2751
    lib/ruby-lint/definitions/rails/action_view.rb on lines 4034..4065
    lib/ruby-lint/definitions/rails/active_model.rb on lines 139..170
    lib/ruby-lint/definitions/rails/active_model.rb on lines 495..526
    lib/ruby-lint/definitions/rails/active_record.rb on lines 3877..3908
    lib/ruby-lint/definitions/rails/active_record.rb on lines 4482..4513
    lib/ruby-lint/definitions/rails/active_record.rb on lines 6561..6592
    lib/ruby-lint/definitions/rails/active_record.rb on lines 6736..6767
    lib/ruby-lint/definitions/rails/active_record.rb on lines 7080..7111
    lib/ruby-lint/definitions/rails/active_record.rb on lines 8781..8812
    lib/ruby-lint/definitions/rails/active_support.rb on lines 1245..1276
    lib/ruby-lint/definitions/rails/active_support.rb on lines 1718..1749
    lib/ruby-lint/definitions/rails/active_support.rb on lines 2080..2111
    lib/ruby-lint/definitions/rails/active_support.rb on lines 2514..2545
    lib/ruby-lint/definitions/rails/active_support.rb on lines 3741..3772
    lib/ruby-lint/definitions/rails/active_support.rb on lines 4045..4076
    lib/ruby-lint/definitions/rails/arel.rb on lines 45..76
    lib/ruby-lint/definitions/rails/arel.rb on lines 188..219
    lib/ruby-lint/definitions/rails/arel.rb on lines 331..362
    lib/ruby-lint/definitions/rails/arel.rb on lines 474..505
    lib/ruby-lint/definitions/rails/arel.rb on lines 617..648
    lib/ruby-lint/definitions/rails/arel.rb on lines 760..791
    lib/ruby-lint/definitions/rails/arel.rb on lines 903..934
    lib/ruby-lint/definitions/rails/arel.rb on lines 1046..1077
    lib/ruby-lint/definitions/rails/arel.rb on lines 1203..1234
    lib/ruby-lint/definitions/rails/arel.rb on lines 1471..1502
    lib/ruby-lint/definitions/rails/arel.rb on lines 1552..1583
    lib/ruby-lint/definitions/rails/arel.rb on lines 1611..1642
    lib/ruby-lint/definitions/rails/arel.rb on lines 1677..1708
    lib/ruby-lint/definitions/rails/arel.rb on lines 1736..1767
    lib/ruby-lint/definitions/rails/arel.rb on lines 1795..1826
    lib/ruby-lint/definitions/rails/arel.rb on lines 1854..1885
    lib/ruby-lint/definitions/rails/arel.rb on lines 1913..1944
    lib/ruby-lint/definitions/rails/arel.rb on lines 1996..2027
    lib/ruby-lint/definitions/rails/arel.rb on lines 2107..2138
    lib/ruby-lint/definitions/rails/arel.rb on lines 2171..2202
    lib/ruby-lint/definitions/rails/arel.rb on lines 2244..2275
    lib/ruby-lint/definitions/rails/arel.rb on lines 2310..2341
    lib/ruby-lint/definitions/rails/arel.rb on lines 2374..2405
    lib/ruby-lint/definitions/rails/arel.rb on lines 2433..2464
    lib/ruby-lint/definitions/rails/arel.rb on lines 2498..2529
    lib/ruby-lint/definitions/rails/arel.rb on lines 2557..2588
    lib/ruby-lint/definitions/rails/arel.rb on lines 2621..2652
    lib/ruby-lint/definitions/rails/arel.rb on lines 2680..2711
    lib/ruby-lint/definitions/rails/arel.rb on lines 2739..2770
    lib/ruby-lint/definitions/rails/arel.rb on lines 2830..2861
    lib/ruby-lint/definitions/rails/arel.rb on lines 2894..2925
    lib/ruby-lint/definitions/rails/arel.rb on lines 2958..2989
    lib/ruby-lint/definitions/rails/arel.rb on lines 3049..3080
    lib/ruby-lint/definitions/rails/arel.rb on lines 3108..3139
    lib/ruby-lint/definitions/rails/arel.rb on lines 3167..3198
    lib/ruby-lint/definitions/rails/arel.rb on lines 3226..3257
    lib/ruby-lint/definitions/rails/arel.rb on lines 3286..3317
    lib/ruby-lint/definitions/rails/arel.rb on lines 3345..3376
    lib/ruby-lint/definitions/rails/arel.rb on lines 3404..3435
    lib/ruby-lint/definitions/rails/arel.rb on lines 3477..3508
    lib/ruby-lint/definitions/rails/arel.rb on lines 3536..3567
    lib/ruby-lint/definitions/rails/arel.rb on lines 3618..3649
    lib/ruby-lint/definitions/rails/arel.rb on lines 3677..3708
    lib/ruby-lint/definitions/rails/arel.rb on lines 3736..3767
    lib/ruby-lint/definitions/rails/arel.rb on lines 3803..3834
    lib/ruby-lint/definitions/rails/arel.rb on lines 3862..3893
    lib/ruby-lint/definitions/rails/arel.rb on lines 3921..3952
    lib/ruby-lint/definitions/rails/arel.rb on lines 3980..4011
    lib/ruby-lint/definitions/rails/arel.rb on lines 4039..4070
    lib/ruby-lint/definitions/rails/arel.rb on lines 4098..4129
    lib/ruby-lint/definitions/rails/arel.rb on lines 4157..4188
    lib/ruby-lint/definitions/rails/arel.rb on lines 4216..4247
    lib/ruby-lint/definitions/rails/arel.rb on lines 4281..4312
    lib/ruby-lint/definitions/rails/arel.rb on lines 4361..4392
    lib/ruby-lint/definitions/rails/arel.rb on lines 4439..4470
    lib/ruby-lint/definitions/rails/arel.rb on lines 4517..4548
    lib/ruby-lint/definitions/rails/arel.rb on lines 4576..4607
    lib/ruby-lint/definitions/rails/arel.rb on lines 4635..4666
    lib/ruby-lint/definitions/rails/arel.rb on lines 4694..4725
    lib/ruby-lint/definitions/rails/arel.rb on lines 4753..4784
    lib/ruby-lint/definitions/rails/arel.rb on lines 4812..4843
    lib/ruby-lint/definitions/rails/arel.rb on lines 4871..4902
    lib/ruby-lint/definitions/rails/arel.rb on lines 4930..4961
    lib/ruby-lint/definitions/rails/arel.rb on lines 4989..5020
    lib/ruby-lint/definitions/rails/arel.rb on lines 5057..5088
    lib/ruby-lint/definitions/rails/arel.rb on lines 5121..5152
    lib/ruby-lint/definitions/rails/arel.rb on lines 5185..5216
    lib/ruby-lint/definitions/rails/arel.rb on lines 5249..5280
    lib/ruby-lint/definitions/rails/arel.rb on lines 5363..5394
    lib/ruby-lint/definitions/rails/arel.rb on lines 5459..5490
    lib/ruby-lint/definitions/rails/arel.rb on lines 5573..5604
    lib/ruby-lint/definitions/rails/arel.rb on lines 5638..5669
    lib/ruby-lint/definitions/rails/arel.rb on lines 5697..5728
    lib/ruby-lint/definitions/rails/arel.rb on lines 5769..5800
    lib/ruby-lint/definitions/rails/arel.rb on lines 5828..5859
    lib/ruby-lint/definitions/rails/arel.rb on lines 5892..5923
    lib/ruby-lint/definitions/rails/arel.rb on lines 5972..6003
    lib/ruby-lint/definitions/rails/arel.rb on lines 6031..6062
    lib/ruby-lint/definitions/rails/arel.rb on lines 6090..6121
    lib/ruby-lint/definitions/rails/arel.rb on lines 6158..6189
    lib/ruby-lint/definitions/rails/arel.rb on lines 6252..6283
    lib/ruby-lint/definitions/rails/arel.rb on lines 6325..6356
    lib/ruby-lint/definitions/rails/arel.rb on lines 6421..6452
    lib/ruby-lint/definitions/rails/arel.rb on lines 6481..6512
    lib/ruby-lint/definitions/rails/arel.rb on lines 6540..6571
    lib/ruby-lint/definitions/rails/arel.rb on lines 6882..6913
    lib/ruby-lint/definitions/rails/arel.rb on lines 7303..7334
    lib/ruby-lint/definitions/rails/rails.rb on lines 951..982
    lib/ruby-lint/definitions/rails/rails.rb on lines 1549..1580
    lib/ruby-lint/definitions/rails/sprockets.rb on lines 884..915
    lib/ruby-lint/definitions/rails/sprockets.rb on lines 1505..1536

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

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

      defs.define_constant('UNIXServer::StreamCopier') do |klass|
        klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
    
        klass.define_instance_method('initialize') do |method|
          method.define_argument('from')
    Severity: Major
    Found in lib/ruby-lint/definitions/core/unixserver.rb and 9 other locations - About 1 hr to fix
    lib/ruby-lint/definitions/core/basic_socket.rb on lines 505..525
    lib/ruby-lint/definitions/core/file.rb on lines 1467..1487
    lib/ruby-lint/definitions/core/io.rb on lines 765..785
    lib/ruby-lint/definitions/core/ipsocket.rb on lines 459..479
    lib/ruby-lint/definitions/core/socket.rb on lines 3145..3165
    lib/ruby-lint/definitions/core/tcpserver.rb on lines 446..466
    lib/ruby-lint/definitions/core/tcpsocket.rb on lines 460..480
    lib/ruby-lint/definitions/core/udpsocket.rb on lines 461..481
    lib/ruby-lint/definitions/core/unixsocket.rb on lines 474..494

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

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

      defs.define_constant('UNIXServer::EachReader') do |klass|
        klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
    
        klass.define_instance_method('each')
    
    
    Severity: Major
    Found in lib/ruby-lint/definitions/core/unixserver.rb and 9 other locations - About 1 hr to fix
    lib/ruby-lint/definitions/core/basic_socket.rb on lines 165..185
    lib/ruby-lint/definitions/core/file.rb on lines 596..616
    lib/ruby-lint/definitions/core/io.rb on lines 507..527
    lib/ruby-lint/definitions/core/ipsocket.rb on lines 119..139
    lib/ruby-lint/definitions/core/socket.rb on lines 1487..1507
    lib/ruby-lint/definitions/core/tcpserver.rb on lines 106..126
    lib/ruby-lint/definitions/core/tcpsocket.rb on lines 120..140
    lib/ruby-lint/definitions/core/udpsocket.rb on lines 121..141
    lib/ruby-lint/definitions/core/unixsocket.rb on lines 134..154

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

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

      defs.define_constant('UNIXServer::SortedElement') do |klass|
        klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
    
        klass.define_instance_method('<=>') do |method|
          method.define_argument('other')
    Severity: Major
    Found in lib/ruby-lint/definitions/core/unixserver.rb and 191 other locations - About 55 mins to fix
    lib/ruby-lint/definitions/core/array.rb on lines 417..433
    lib/ruby-lint/definitions/core/basic_socket.rb on lines 486..502
    lib/ruby-lint/definitions/core/cgi.rb on lines 135..151
    lib/ruby-lint/definitions/core/csv.rb on lines 457..473
    lib/ruby-lint/definitions/core/csv.rb on lines 699..715
    lib/ruby-lint/definitions/core/csv.rb on lines 718..734
    lib/ruby-lint/definitions/core/csv.rb on lines 865..881
    lib/ruby-lint/definitions/core/enumerable.rb on lines 167..183
    lib/ruby-lint/definitions/core/file.rb on lines 1213..1229
    lib/ruby-lint/definitions/core/gem.rb on lines 830..846
    lib/ruby-lint/definitions/core/hash.rb on lines 490..506
    lib/ruby-lint/definitions/core/io.rb on lines 746..762
    lib/ruby-lint/definitions/core/ipsocket.rb on lines 440..456
    lib/ruby-lint/definitions/core/irb.rb on lines 375..391
    lib/ruby-lint/definitions/core/matrix.rb on lines 494..510
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 196..212
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 444..460
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 503..519
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 812..828
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 1221..1237
    lib/ruby-lint/definitions/core/open_ssl.rb on lines 3256..3272
    lib/ruby-lint/definitions/core/option_parser.rb on lines 557..573
    lib/ruby-lint/definitions/core/option_parser.rb on lines 1027..1043
    lib/ruby-lint/definitions/core/prime.rb on lines 142..158
    lib/ruby-lint/definitions/core/prime.rb on lines 231..247
    lib/ruby-lint/definitions/core/prime.rb on lines 332..348
    lib/ruby-lint/definitions/core/prime.rb on lines 351..367
    lib/ruby-lint/definitions/core/prime.rb on lines 446..462
    lib/ruby-lint/definitions/core/range.rb on lines 137..153
    lib/ruby-lint/definitions/core/set.rb on lines 216..232
    lib/ruby-lint/definitions/core/socket.rb on lines 3126..3142
    lib/ruby-lint/definitions/core/sorted_set.rb on lines 64..80
    lib/ruby-lint/definitions/core/string_io.rb on lines 319..335
    lib/ruby-lint/definitions/core/struct.rb on lines 158..174
    lib/ruby-lint/definitions/core/syck.rb on lines 396..412
    lib/ruby-lint/definitions/core/syck.rb on lines 509..525
    lib/ruby-lint/definitions/core/syck.rb on lines 895..911
    lib/ruby-lint/definitions/core/syck.rb on lines 1197..1213
    lib/ruby-lint/definitions/core/tcpserver.rb on lines 427..443
    lib/ruby-lint/definitions/core/tcpsocket.rb on lines 441..457
    lib/ruby-lint/definitions/core/udpsocket.rb on lines 442..458
    lib/ruby-lint/definitions/core/unixsocket.rb on lines 455..471
    lib/ruby-lint/definitions/core/vector.rb on lines 201..217
    lib/ruby-lint/definitions/core/webrick.rb on lines 580..596
    lib/ruby-lint/definitions/core/zlib.rb on lines 291..307
    lib/ruby-lint/definitions/gems/mongoid.rb on lines 569..585
    lib/ruby-lint/definitions/gems/mongoid.rb on lines 1551..1567
    lib/ruby-lint/definitions/gems/mongoid.rb on lines 1672..1688
    lib/ruby-lint/definitions/gems/mongoid.rb on lines 1894..1910
    lib/ruby-lint/definitions/gems/mongoid.rb on lines 2146..2162
    lib/ruby-lint/definitions/gems/mongoid.rb on lines 2234..2250
    lib/ruby-lint/definitions/gems/mongoid.rb on lines 2350..2366
    lib/ruby-lint/definitions/gems/mongoid.rb on lines 3159..3175
    lib/ruby-lint/definitions/gems/mongoid.rb on lines 5744..5760
    lib/ruby-lint/definitions/gems/mongoid.rb on lines 7358..7374
    lib/ruby-lint/definitions/gems/mongoid.rb on lines 8182..8198
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 1072..1088
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 1306..1322
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 2133..2149
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 2569..2585
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 2794..2810
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 3104..3120
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 3323..3339
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 3542..3558
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 3779..3795
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 4125..4141
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 4378..4394
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 4596..4612
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 4877..4893
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 5144..5160
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 5363..5379
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 5899..5915
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 6157..6173
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 6321..6337
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 6876..6892
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 7022..7038
    lib/ruby-lint/definitions/gems/nokogiri.rb on lines 7560..7576
    lib/ruby-lint/definitions/gems/sinatra.rb on lines 1382..1398
    lib/ruby-lint/definitions/rails/action_controller.rb on lines 2186..2202
    lib/ruby-lint/definitions/rails/action_controller.rb on lines 2371..2387
    lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 511..527
    lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 881..897
    lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 1202..1218
    lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 2501..2517
    lib/ruby-lint/definitions/rails/action_dispatch.rb on lines 2787..2803
    lib/ruby-lint/definitions/rails/action_view.rb on lines 4069..4085
    lib/ruby-lint/definitions/rails/active_model.rb on lines 209..225
    lib/ruby-lint/definitions/rails/active_model.rb on lines 530..546
    lib/ruby-lint/definitions/rails/active_record.rb on lines 3947..3963
    lib/ruby-lint/definitions/rails/active_record.rb on lines 4552..4568
    lib/ruby-lint/definitions/rails/active_record.rb on lines 6631..6647
    lib/ruby-lint/definitions/rails/active_record.rb on lines 6806..6822
    lib/ruby-lint/definitions/rails/active_record.rb on lines 7150..7166
    lib/ruby-lint/definitions/rails/active_record.rb on lines 8816..8832
    lib/ruby-lint/definitions/rails/active_support.rb on lines 1280..1296
    lib/ruby-lint/definitions/rails/active_support.rb on lines 1753..1769
    lib/ruby-lint/definitions/rails/active_support.rb on lines 2139..2155
    lib/ruby-lint/definitions/rails/active_support.rb on lines 2573..2589
    lib/ruby-lint/definitions/rails/active_support.rb on lines 3800..3816
    lib/ruby-lint/definitions/rails/active_support.rb on lines 4104..4120
    lib/ruby-lint/definitions/rails/arel.rb on lines 115..131
    lib/ruby-lint/definitions/rails/arel.rb on lines 258..274
    lib/ruby-lint/definitions/rails/arel.rb on lines 401..417
    lib/ruby-lint/definitions/rails/arel.rb on lines 544..560
    lib/ruby-lint/definitions/rails/arel.rb on lines 687..703
    lib/ruby-lint/definitions/rails/arel.rb on lines 830..846
    lib/ruby-lint/definitions/rails/arel.rb on lines 973..989
    lib/ruby-lint/definitions/rails/arel.rb on lines 1116..1132
    lib/ruby-lint/definitions/rails/arel.rb on lines 1238..1254
    lib/ruby-lint/definitions/rails/arel.rb on lines 1506..1522
    lib/ruby-lint/definitions/rails/arel.rb on lines 1587..1603
    lib/ruby-lint/definitions/rails/arel.rb on lines 1646..1662
    lib/ruby-lint/definitions/rails/arel.rb on lines 1712..1728
    lib/ruby-lint/definitions/rails/arel.rb on lines 1771..1787
    lib/ruby-lint/definitions/rails/arel.rb on lines 1830..1846
    lib/ruby-lint/definitions/rails/arel.rb on lines 1889..1905
    lib/ruby-lint/definitions/rails/arel.rb on lines 1948..1964
    lib/ruby-lint/definitions/rails/arel.rb on lines 2031..2047
    lib/ruby-lint/definitions/rails/arel.rb on lines 2142..2158
    lib/ruby-lint/definitions/rails/arel.rb on lines 2206..2222
    lib/ruby-lint/definitions/rails/arel.rb on lines 2279..2295
    lib/ruby-lint/definitions/rails/arel.rb on lines 2345..2361
    lib/ruby-lint/definitions/rails/arel.rb on lines 2409..2425
    lib/ruby-lint/definitions/rails/arel.rb on lines 2468..2484
    lib/ruby-lint/definitions/rails/arel.rb on lines 2533..2549
    lib/ruby-lint/definitions/rails/arel.rb on lines 2592..2608
    lib/ruby-lint/definitions/rails/arel.rb on lines 2656..2672
    lib/ruby-lint/definitions/rails/arel.rb on lines 2715..2731
    lib/ruby-lint/definitions/rails/arel.rb on lines 2774..2790
    lib/ruby-lint/definitions/rails/arel.rb on lines 2865..2881
    lib/ruby-lint/definitions/rails/arel.rb on lines 2929..2945
    lib/ruby-lint/definitions/rails/arel.rb on lines 2993..3009
    lib/ruby-lint/definitions/rails/arel.rb on lines 3084..3100
    lib/ruby-lint/definitions/rails/arel.rb on lines 3143..3159
    lib/ruby-lint/definitions/rails/arel.rb on lines 3202..3218
    lib/ruby-lint/definitions/rails/arel.rb on lines 3261..3277
    lib/ruby-lint/definitions/rails/arel.rb on lines 3321..3337
    lib/ruby-lint/definitions/rails/arel.rb on lines 3380..3396
    lib/ruby-lint/definitions/rails/arel.rb on lines 3439..3455
    lib/ruby-lint/definitions/rails/arel.rb on lines 3512..3528
    lib/ruby-lint/definitions/rails/arel.rb on lines 3571..3587
    lib/ruby-lint/definitions/rails/arel.rb on lines 3653..3669
    lib/ruby-lint/definitions/rails/arel.rb on lines 3712..3728
    lib/ruby-lint/definitions/rails/arel.rb on lines 3771..3787
    lib/ruby-lint/definitions/rails/arel.rb on lines 3838..3854
    lib/ruby-lint/definitions/rails/arel.rb on lines 3897..3913
    lib/ruby-lint/definitions/rails/arel.rb on lines 3956..3972
    lib/ruby-lint/definitions/rails/arel.rb on lines 4015..4031
    lib/ruby-lint/definitions/rails/arel.rb on lines 4074..4090
    lib/ruby-lint/definitions/rails/arel.rb on lines 4133..4149
    lib/ruby-lint/definitions/rails/arel.rb on lines 4192..4208
    lib/ruby-lint/definitions/rails/arel.rb on lines 4251..4267
    lib/ruby-lint/definitions/rails/arel.rb on lines 4316..4332
    lib/ruby-lint/definitions/rails/arel.rb on lines 4396..4412
    lib/ruby-lint/definitions/rails/arel.rb on lines 4474..4490
    lib/ruby-lint/definitions/rails/arel.rb on lines 4552..4568
    lib/ruby-lint/definitions/rails/arel.rb on lines 4611..4627
    lib/ruby-lint/definitions/rails/arel.rb on lines 4670..4686
    lib/ruby-lint/definitions/rails/arel.rb on lines 4729..4745
    lib/ruby-lint/definitions/rails/arel.rb on lines 4788..4804
    lib/ruby-lint/definitions/rails/arel.rb on lines 4847..4863
    lib/ruby-lint/definitions/rails/arel.rb on lines 4906..4922
    lib/ruby-lint/definitions/rails/arel.rb on lines 4965..4981
    lib/ruby-lint/definitions/rails/arel.rb on lines 5024..5040
    lib/ruby-lint/definitions/rails/arel.rb on lines 5092..5108
    lib/ruby-lint/definitions/rails/arel.rb on lines 5156..5172
    lib/ruby-lint/definitions/rails/arel.rb on lines 5220..5236
    lib/ruby-lint/definitions/rails/arel.rb on lines 5284..5300
    lib/ruby-lint/definitions/rails/arel.rb on lines 5398..5414
    lib/ruby-lint/definitions/rails/arel.rb on lines 5494..5510
    lib/ruby-lint/definitions/rails/arel.rb on lines 5608..5624
    lib/ruby-lint/definitions/rails/arel.rb on lines 5673..5689
    lib/ruby-lint/definitions/rails/arel.rb on lines 5732..5748
    lib/ruby-lint/definitions/rails/arel.rb on lines 5804..5820
    lib/ruby-lint/definitions/rails/arel.rb on lines 5863..5879
    lib/ruby-lint/definitions/rails/arel.rb on lines 5927..5943
    lib/ruby-lint/definitions/rails/arel.rb on lines 6007..6023
    lib/ruby-lint/definitions/rails/arel.rb on lines 6066..6082
    lib/ruby-lint/definitions/rails/arel.rb on lines 6125..6141
    lib/ruby-lint/definitions/rails/arel.rb on lines 6193..6209
    lib/ruby-lint/definitions/rails/arel.rb on lines 6287..6303
    lib/ruby-lint/definitions/rails/arel.rb on lines 6360..6376
    lib/ruby-lint/definitions/rails/arel.rb on lines 6456..6472
    lib/ruby-lint/definitions/rails/arel.rb on lines 6516..6532
    lib/ruby-lint/definitions/rails/arel.rb on lines 6575..6591
    lib/ruby-lint/definitions/rails/arel.rb on lines 6952..6968
    lib/ruby-lint/definitions/rails/arel.rb on lines 7373..7389
    lib/ruby-lint/definitions/rails/rails.rb on lines 986..1002
    lib/ruby-lint/definitions/rails/rails.rb on lines 1584..1600
    lib/ruby-lint/definitions/rails/sprockets.rb on lines 954..970
    lib/ruby-lint/definitions/rails/sprockets.rb on lines 1564..1580

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

    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