rubinius/rubinius

View on GitHub
library/rubygems/specification.rb

Summary

Maintainability
F
1 wk
Test Coverage

File specification.rb has 1649 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rubygems/version'
require 'rubygems/requirement'
require 'rubygems/platform'
require 'rubygems/deprecate'
require 'rubygems/basic_specification'
Severity: Major
Found in library/rubygems/specification.rb - About 4 days to fix

    Class Specification has 178 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Gem::Specification < Gem::BasicSpecification
    
      # REFACTOR: Consider breaking out this version stuff into a separate
      # module. There's enough special stuff around it that it may justify
      # a separate class.
    Severity: Major
    Found in library/rubygems/specification.rb - About 3 days to fix

      Method validate has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
      Open

        def validate packaging = true
          @warnings = 0
          require 'rubygems/user_interaction'
          extend Gem::UserInteraction
          normalize
      Severity: Minor
      Found in library/rubygems/specification.rb - About 1 day 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 validate has 143 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def validate packaging = true
          @warnings = 0
          require 'rubygems/user_interaction'
          extend Gem::UserInteraction
          normalize
      Severity: Major
      Found in library/rubygems/specification.rb - About 5 hrs to fix

        Method to_ruby has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def to_ruby
            mark_version
            result = []
            result << "# -*- encoding: utf-8 -*-"
            result << "#{Gem::StubSpecification::PREFIX}#{name} #{version} #{platform} #{raw_require_paths.join("\0")}"
        Severity: Major
        Found in library/rubygems/specification.rb - About 2 hrs to fix

          Method to_ruby has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

            def to_ruby
              mark_version
              result = []
              result << "# -*- encoding: utf-8 -*-"
              result << "#{Gem::StubSpecification::PREFIX}#{name} #{version} #{platform} #{raw_require_paths.join("\0")}"
          Severity: Minor
          Found in library/rubygems/specification.rb - About 2 hrs 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 traverse has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

            def traverse trail = [], visited = {}, &block
              trail.push(self)
              begin
                dependencies.each do |dep|
                  next unless dep.runtime?
          Severity: Minor
          Found in library/rubygems/specification.rb - About 2 hrs 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 validate_dependencies has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

            def validate_dependencies # :nodoc:
              # NOTE: see REFACTOR note in Gem::Dependency about types - this might be brittle
              seen = Gem::Dependency::TYPES.inject({}) { |types, type| types.merge({ type => {}}) }
          
              error_messages = []
          Severity: Minor
          Found in library/rubygems/specification.rb - About 2 hrs 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 validate_dependencies has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def validate_dependencies # :nodoc:
              # NOTE: see REFACTOR note in Gem::Dependency about types - this might be brittle
              seen = Gem::Dependency::TYPES.inject({}) { |types, type| types.merge({ type => {}}) }
          
              error_messages = []
          Severity: Major
          Found in library/rubygems/specification.rb - About 2 hrs to fix

            Method validate_permissions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def validate_permissions
                return if Gem.win_platform?
            
                files.each do |file|
                  next unless File.file?(file)
            Severity: Minor
            Found in library/rubygems/specification.rb - About 1 hr 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 validate_metadata has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def validate_metadata
                url_validation_regex = %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}
                link_keys = %w(
                  bug_tracker_uri
                  changelog_uri
            Severity: Minor
            Found in library/rubygems/specification.rb - About 1 hr 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 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self._load(str)
                array = Marshal.load str
            
                spec = Gem::Specification.new
                spec.instance_variable_set :@specification_version, array[1]
            Severity: Minor
            Found in library/rubygems/specification.rb - About 1 hr to fix

              Method validate_metadata has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def validate_metadata
                  url_validation_regex = %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}
                  link_keys = %w(
                    bug_tracker_uri
                    changelog_uri
              Severity: Minor
              Found in library/rubygems/specification.rb - About 1 hr to fix

                Method to_yaml has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  def to_yaml(opts = {}) # :nodoc:
                    if (YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck?) ||
                        (defined?(Psych) && YAML == Psych) then
                      # Because the user can switch the YAML engine behind our
                      # back, we have to check again here to make sure that our
                Severity: Minor
                Found in library/rubygems/specification.rb - About 1 hr 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 activate_dependencies has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def activate_dependencies
                    unresolved = Gem::Specification.unresolved_deps
                
                    self.runtime_dependencies.each do |spec_dep|
                      if loaded = Gem.loaded_specs[spec_dep.name]
                Severity: Minor
                Found in library/rubygems/specification.rb - About 55 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_copy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def initialize_copy other_spec
                    self.class.array_attributes.each do |name|
                      name = :"@#{name}"
                      next unless other_spec.instance_variable_defined? name
                
                
                Severity: Minor
                Found in library/rubygems/specification.rb - About 55 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 pretty_print has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def pretty_print(q) # :nodoc:
                    q.group 2, 'Gem::Specification.new do |s|', 'end' do
                      q.breakable
                
                      attributes = @@attributes - [:name, :version]
                Severity: Minor
                Found in library/rubygems/specification.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.load file
                    return unless file
                
                    _spec = LOAD_CACHE[file]
                    return _spec if _spec
                Severity: Minor
                Found in library/rubygems/specification.rb - About 55 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 _all has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self._all # :nodoc:
                    unless defined?(@@all) && @@all then
                      @@all = stubs.map(&:to_spec)
                      if @@all.any?(&:nil?) # TODO: remove once we're happy
                        raise "pid: #{$$} nil spec! included in #{stubs.inspect}"
                Severity: Minor
                Found in library/rubygems/specification.rb - About 45 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 find_inactive_by_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.find_inactive_by_path path
                    stub = stubs.find { |s|
                      next if s.activated?
                      next unless Gem::BundlerVersionFinder.compatible?(s)
                      s.contains_requirable_file? path
                Severity: Minor
                Found in library/rubygems/specification.rb - About 45 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 normalize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def normalize
                    if defined?(@extra_rdoc_files) and @extra_rdoc_files then
                      @extra_rdoc_files.uniq!
                      @files ||= []
                      @files.concat(@extra_rdoc_files)
                Severity: Minor
                Found in library/rubygems/specification.rb - About 45 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 _latest_specs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self._latest_specs specs, prerelease = false # :nodoc:
                    result = Hash.new { |h,k| h[k] = {} }
                    native = {}
                
                    specs.reverse_each do |spec|
                Severity: Minor
                Found in library/rubygems/specification.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 conflicts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def conflicts
                    conflicts = {}
                    self.runtime_dependencies.each { |dep|
                      spec = Gem.loaded_specs[dep.name]
                      if spec and not spec.satisfies_requirement? dep
                Severity: Minor
                Found in library/rubygems/specification.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 build_extensions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def build_extensions # :nodoc:
                    return if default_gem?
                    return if extensions.empty?
                    return if installed_by_version < Gem::Version.new('2.2.0.preview.2')
                    return if File.exist? gem_build_complete_path
                Severity: Minor
                Found in library/rubygems/specification.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

                Avoid too many return statements within this method.
                Open

                    return if !File.writable?(base_dir)
                Severity: Major
                Found in library/rubygems/specification.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                      return if !File.exist?(File.join(base_dir, 'extensions'))
                  Severity: Major
                  Found in library/rubygems/specification.rb - About 30 mins to fix

                    Method has_conflicts? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def has_conflicts?
                        return true unless Gem.env_requirement(name).satisfied_by?(version)
                        self.dependencies.any? { |dep|
                          if dep.runtime? then
                            spec = Gem.loaded_specs[dep.name]
                    Severity: Minor
                    Found in library/rubygems/specification.rb - About 25 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 add_spec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def self.add_spec spec
                        warn "Gem::Specification.add_spec is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
                        # TODO: find all extraneous adds
                        # puts
                        # p :add_spec => [spec.full_name, caller.reject { |s| s =~ /minitest/ }]
                    Severity: Minor
                    Found in library/rubygems/specification.rb - About 25 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 add_bindir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def add_bindir(executables)
                        return nil if executables.nil?
                    
                        if @bindir then
                          Array(executables).map { |e| File.join(@bindir, e) }
                    Severity: Minor
                    Found in library/rubygems/specification.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def self._load(str)
                        array = Marshal.load str
                    
                        spec = Gem::Specification.new
                        spec.instance_variable_set :@specification_version, array[1]
                    Severity: Minor
                    Found in library/rubygems/specification.rb - About 25 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 ruby_code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def ruby_code(obj)
                        case obj
                        when String            then obj.dump + ".freeze"
                        when Array             then '[' + obj.map { |x| ruby_code x }.join(", ") + ']'
                        when Hash              then
                    Severity: Minor
                    Found in library/rubygems/specification.rb - About 25 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 2 locations. Consider refactoring.
                    Open

                            warning_messages << <<-WARNING
                    open-ended dependency on #{dep} is not recommended
                      if #{dep.name} is semantically versioned, use:
                    Severity: Minor
                    Found in library/rubygems/specification.rb and 1 other location - About 15 mins to fix
                    library/rubygems/specification.rb on lines 2949..2951

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

                            warning_messages << <<-WARNING
                    pessimistic dependency on #{dep} may be overly strict
                      if #{dep.name} is semantically versioned, use:
                    Severity: Minor
                    Found in library/rubygems/specification.rb and 1 other location - About 15 mins to fix
                    library/rubygems/specification.rb on lines 2971..2973

                    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