rspec/rspec-core

View on GitHub

Showing 12 of 94 total issues

Class Configuration has 132 methods (exceeds 20 allowed). Consider refactoring.

    class Configuration
      include RSpec::Core::Hooks

      # Module that holds `attr_reader` declarations. It's in a separate
      # module to allow us to override those methods and use `super`.
Severity: Major
Found in lib/rspec/core/configuration.rb - About 2 days to fix

    File configuration.rb has 957 lines of code (exceeds 250 allowed). Consider refactoring.

    RSpec::Support.require_rspec_core "backtrace_formatter"
    RSpec::Support.require_rspec_core "ruby_project"
    RSpec::Support.require_rspec_core "formatters/deprecation_formatter"
    RSpec::Support.require_rspec_core "output_wrapper"
    
    
    Severity: Major
    Found in lib/rspec/core/configuration.rb - About 2 days to fix

      Method parser has 200 lines of code (exceeds 25 allowed). Consider refactoring.

          def parser(options)
            OptionParser.new do |parser|
              parser.summary_width = 34
      
              parser.banner = "Usage: rspec [options] [files or directories]\n\n"
      Severity: Major
      Found in lib/rspec/core/option_parser.rb - About 1 day to fix

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

                def jenkins_hash_digest(string)
                  hash = 0
        
                  string.each_byte do |byte|
                    hash += byte
        Severity: Major
        Found in lib/rspec/core/ordering.rb and 1 other location - About 1 hr to fix
        benchmarks/hash_functions.rb on lines 6..22

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

        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.

        def jenkins_iterative(string)
          hash = 0
        
          string.each_byte do |byte|
            hash += byte
        Severity: Major
        Found in benchmarks/hash_functions.rb and 1 other location - About 1 hr to fix
        lib/rspec/core/ordering.rb on lines 39..55

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

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

              def prepend_before(scope=nil, *meta, &block)
                handle_suite_hook(scope, meta) do
                  @before_suite_hooks.unshift Hooks::BeforeHook.new(block, {})
                end || begin
                  # defeat Ruby 2.5 lazy proc allocation to ensure
        Severity: Major
        Found in lib/rspec/core/configuration.rb and 3 other locations - About 40 mins to fix
        lib/rspec/core/configuration.rb on lines 1941..1954
        lib/rspec/core/configuration.rb on lines 1996..2009
        lib/rspec/core/configuration.rb on lines 2026..2039

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

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

              def before(scope=nil, *meta, &block)
                handle_suite_hook(scope, meta) do
                  @before_suite_hooks << Hooks::BeforeHook.new(block, {})
                end || begin
                  # defeat Ruby 2.5 lazy proc allocation to ensure
        Severity: Major
        Found in lib/rspec/core/configuration.rb and 3 other locations - About 40 mins to fix
        lib/rspec/core/configuration.rb on lines 1971..1984
        lib/rspec/core/configuration.rb on lines 1996..2009
        lib/rspec/core/configuration.rb on lines 2026..2039

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

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

              def after(scope=nil, *meta, &block)
                handle_suite_hook(scope, meta) do
                  @after_suite_hooks.unshift Hooks::AfterHook.new(block, {})
                end || begin
                  # defeat Ruby 2.5 lazy proc allocation to ensure
        Severity: Major
        Found in lib/rspec/core/configuration.rb and 3 other locations - About 40 mins to fix
        lib/rspec/core/configuration.rb on lines 1941..1954
        lib/rspec/core/configuration.rb on lines 1971..1984
        lib/rspec/core/configuration.rb on lines 2026..2039

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

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

              def append_after(scope=nil, *meta, &block)
                handle_suite_hook(scope, meta) do
                  @after_suite_hooks << Hooks::AfterHook.new(block, {})
                end || begin
                  # defeat Ruby 2.5 lazy proc allocation to ensure
        Severity: Major
        Found in lib/rspec/core/configuration.rb and 3 other locations - About 40 mins to fix
        lib/rspec/core/configuration.rb on lines 1941..1954
        lib/rspec/core/configuration.rb on lines 1971..1984
        lib/rspec/core/configuration.rb on lines 1996..2009

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

        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

        Avoid too many return statements within this method.

                    return proc_filter_applies?(key, filter_value, metadata) if Proc === filter_value
        Severity: Major
        Found in lib/rspec/core/metadata_filter.rb - About 30 mins to fix

          Avoid too many return statements within this method.

                      return true if TrueClass === filter_value && meta_value
          Severity: Major
          Found in lib/rspec/core/metadata_filter.rb - About 30 mins to fix

            Avoid too many return statements within this method.

                        return filter_applies_to_any_value?(key, filter_value, metadata) if Array === meta_value
            Severity: Major
            Found in lib/rspec/core/metadata_filter.rb - About 30 mins to fix
              Severity
              Category