rubinius/rubinius

View on GitHub

Showing 1,079 of 1,541 total issues

Method parse has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def parse(argv=ARGV)
    argv = Array(argv).dup

    while entry = argv.shift
      # collect everything that is not an option
Severity: Minor
Found in mspec/lib/mspec/utils/options.rb - About 3 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 rindex has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def rindex(sub, finish=undefined)
    if undefined.equal?(finish)
      finish = size
    else
      finish = Rubinius::Type.coerce_to(finish, Integer, :to_int)
Severity: Minor
Found in core/string.rb - About 3 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_and_convert_argument has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def self.validate_and_convert_argument(objects)
      if objects
        raise TypeError, "Argument must be an Array" unless objects.respond_to?(:to_ary)
        objects =
          objects.to_ary.map do |obj|
Severity: Minor
Found in core/io.rb - About 3 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 ** has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def **(other)
    if other.kind_of?(Rational) && other.denominator == 1
      other = other.numerator
    end

Severity: Minor
Found in core/rational.rb - About 3 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 glob has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def self.glob(pattern, flags, matches=[])
      # Rubygems uses Dir[] as a glorified File.exist?  to check for multiple
      # extensions. So we went ahead and sped up that specific case.

      if flags == 0 and
Severity: Minor
Found in core/dir_glob.rb - About 3 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

File resolution.rb has 320 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Gem::Resolver::Molinillo
  class Resolver
    # A specific resolution from a given {Resolver}
    class Resolution
      # A conflict that the resolution process encountered
Severity: Minor
Found in library/rubygems/resolver/molinillo/lib/molinillo/resolution.rb - About 3 hrs to fix

    Class Resolution has 30 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Resolution
          # A conflict that the resolution process encountered
          # @attr [Object] requirement the requirement that immediately led to the conflict
          # @attr [{String,Nil=>[Object]}] requirements the requirements that caused the conflict
          # @attr [Object, nil] existing the existing spec that was in conflict with
    Severity: Minor
    Found in library/rubygems/resolver/molinillo/lib/molinillo/resolution.rb - About 3 hrs to fix

      Class MSpecOptions has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class MSpecOptions
        # Raised if incorrect or incomplete formats are passed to #on.
        class OptionError < Exception; end
      
        # Raised if an unrecognized option is encountered.
      Severity: Minor
      Found in mspec/lib/mspec/utils/options.rb - About 3 hrs to fix

        File dependency_installer.rb has 319 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'rubygems'
        require 'rubygems/dependency_list'
        require 'rubygems/package'
        require 'rubygems/installer'
        require 'rubygems/spec_fetcher'
        Severity: Minor
        Found in library/rubygems/dependency_installer.rb - About 3 hrs to fix

          File command.rb has 318 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'optparse'
          require 'rubygems/requirement'
          require 'rubygems/user_interaction'
          
          ##
          Severity: Minor
          Found in library/rubygems/command.rb - About 3 hrs to fix

            Method execute has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

              def execute
                specs = []
                gem = options[:args].shift
            
                unless gem then
            Severity: Minor
            Found in library/rubygems/commands/specification_command.rb - About 3 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 compose has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.compose(offset, p1, p2=nil, p3=nil, p4=nil, p5=nil, p6=nil, p7=nil,
                               yday=undefined, is_dst=undefined, tz=undefined)
                if undefined.equal?(tz)
                  unless undefined.equal?(is_dst)
                    raise ArgumentError, "wrong number of arguments (9 for 1..8)"
            Severity: Minor
            Found in core/time.rb - About 3 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 to_sub_replacement has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

              def to_sub_replacement(result, match)
                index = 0
                while index < @num_bytes
                  current = index
                  while current < @num_bytes && @data[current] != 92  # ?\\
            Severity: Minor
            Found in core/string.rb - About 3 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 basename has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.basename(path, ext=undefined)
                path = Rubinius::Type.coerce_to_path(path)
                m = Rubinius::Mirror.reflect path
            
                slash = "/"
            Severity: Minor
            Found in core/file.rb - About 3 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 set_encoding has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

              def set_encoding(external, internal=nil, options=undefined)
                case external
                when Encoding
                  @external = external
                when String
            Severity: Minor
            Found in core/io.rb - About 3 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 parse has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

                def parse(argv=ARGV)
                  argv = Array(argv)
            
                  while @parse and entry = argv.shift
                    # collect everything that is not an option
            Severity: Minor
            Found in core/options.rb - About 3 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

            File rational.rb has 314 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class Rational < Numeric
              attr_reader :numerator
              attr_reader :denominator
            
              def *(other)
            Severity: Minor
            Found in core/rational.rb - About 3 hrs to fix

              Method add_found_dependencies has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                def add_found_dependencies to_do, dependency_list # :nodoc:
                  seen = {}
                  dependencies = Hash.new { |h, name| h[name] = Gem::Dependency.new name }
              
                  until to_do.empty? do
              Severity: Minor
              Found in library/rubygems/dependency_installer.rb - About 3 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 matches? has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                def matches?(proc)
                  @saved_out = $stdout
                  @saved_err = $stderr
                  @stdout = $stdout = IOStub.new
                  @stderr = $stderr = IOStub.new
              Severity: Minor
              Found in mspec/lib/mspec/matchers/output.rb - About 3 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 write_configure_files has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                def write_configure_files
                  @log.write "\nWriting configuration files..."
              
                  @bin_links.delete @program_name
              
              
              Severity: Minor
              Found in configure.rb - About 3 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

              Severity
              Category
              Status
              Source
              Language