rubinius/rubinius

View on GitHub
core/loader.rb

Summary

Maintainability
F
5 days
Test Coverage

File loader.rb has 660 lines of code (exceeds 250 allowed). Consider refactoring.
Open

TOPLEVEL_BINDING = binding()

module Rubinius
  class Loader
    def initialize
Severity: Major
Found in core/loader.rb - About 1 day to fix

    Method options has 222 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def options(argv=ARGV)
          @stage = "processing command line arguments"
    
          options = Options.new "Usage: rbx [subcommand] [options] [--] [script] [arguments]", 25
    
    
    Severity: Major
    Found in core/loader.rb - About 1 day to fix

      Method options has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          def options(argv=ARGV)
            @stage = "processing command line arguments"
      
            options = Options.new "Usage: rbx [subcommand] [options] [--] [script] [arguments]", 25
      
      
      Severity: Minor
      Found in core/loader.rb - About 6 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

      Class Loader has 37 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Loader
          def initialize
            @exit_code    = 0
            @process_id   = Process.pid
            @load_paths   = []
      Severity: Minor
      Found in core/loader.rb - About 4 hrs to fix

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

            def done
              # check that this is a valid exit rather than failing to process
              # unwinding properly.
              #
              # TODO: this code is pretty gross, nice object inspectors, please.
        Severity: Minor
        Found in core/loader.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 script has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def script
              return unless @script and @evals.empty?
        
              @repl = false
        
        
        Severity: Minor
        Found in core/loader.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 evals has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def evals
              return if @evals.empty?
        
              @repl = false
              @stage = "evaluating command line code"
        Severity: Minor
        Found in core/loader.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 done has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def done
              # check that this is a valid exit rather than failing to process
              # unwinding properly.
              #
              # TODO: this code is pretty gross, nice object inspectors, please.
        Severity: Minor
        Found in core/loader.rb - About 1 hr to fix

          Method check_syntax has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_syntax
                parser_class = Rubinius::ToolSets::Runtime::Melbourne
          
                if @script
                  if File.exist?(@script)
          Severity: Minor
          Found in core/loader.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 handle_simple_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle_simple_options(argv)
                argv.delete_if do |x|
                  if x[0] == ?-
                    if equal = x.index("=")
                      name = x.substring(1, equal-1)
          Severity: Minor
          Found in core/loader.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 handle_rubyopt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle_rubyopt(options)
                if env_opts = ENV['RUBYOPT']
                  Rubinius::Logger.system.write "RUBYOPT: #{env_opts}"
          
                  options.start_parsing
          Severity: Minor
          Found in core/loader.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

          There are no issues that match your filters.

          Category
          Status