erikhuda/thor

View on GitHub

Showing 75 of 83 total issues

Class Thor has 53 methods (exceeds 20 allowed). Consider refactoring.
Open

class Thor
  autoload :Actions,    File.expand_path("actions", __dir__)
  autoload :RakeCompat, File.expand_path("rake_compat", __dir__)
  autoload :Group,      File.expand_path("group", __dir__)

Severity: Major
Found in lib/thor/base.rb - About 7 hrs to fix

    Class Basic has 39 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Basic
          DEFAULT_TERMINAL_WIDTH = 80
    
          attr_accessor :base
          attr_reader   :padding
    Severity: Minor
    Found in lib/thor/shell/basic.rb - About 5 hrs to fix

      Class Thor has 33 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Thor
        $thor_runner ||= false
        class << self
          # Allows for custom "Command" package naming.
          #
      Severity: Minor
      Found in lib/thor.rb - About 4 hrs to fix

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

            def parse(args) # rubocop:disable MethodLength
              @pile = args.dup
              @parsing_options = true
        
              while peek
        Severity: Minor
        Found in lib/thor/parser/options.rb - About 4 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 base.rb has 326 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require_relative "command"
        require_relative "core_ext/hash_with_indifferent_access"
        require_relative "error"
        require_relative "invocation"
        require_relative "nested_context"
        Severity: Minor
        Found in lib/thor/base.rb - About 3 hrs to fix

          File basic.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class Thor
            module Shell
              class Basic
                DEFAULT_TERMINAL_WIDTH = 80
          
          
          Severity: Minor
          Found in lib/thor/shell/basic.rb - About 3 hrs to fix

            File thor.rb has 303 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "set"
            require_relative "thor/base"
            
            class Thor
              $thor_runner ||= false
            Severity: Minor
            Found in lib/thor.rb - About 3 hrs to fix

              Method print_table has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                    def print_table(array, options = {}) # rubocop:disable MethodLength
                      return if array.empty?
              
                      formats = []
                      indent = options[:indent].to_i
              Severity: Minor
              Found in lib/thor/shell/basic.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 get_options_from_invocations has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_options_from_invocations(group_options, base_options) #:nodoc: # rubocop:disable MethodLength
                    invocations.each do |name, from_option|
                      value = if from_option
                        option = class_options[name]
                        option.type == :boolean ? name : option.default
              Severity: Minor
              Found in lib/thor/group.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 install has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                def install(name) # rubocop:disable MethodLength
                  initialize_thorfiles
              
                  # If a directory name is provided as the argument, look for a 'main.thor'
                  # command in said directory.
              Severity: Minor
              Found in lib/thor/runner.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 install has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def install(name) # rubocop:disable MethodLength
                  initialize_thorfiles
              
                  # If a directory name is provided as the argument, look for a 'main.thor'
                  # command in said directory.
              Severity: Minor
              Found in lib/thor/runner.rb - About 2 hrs to fix

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

                      def execute!
                        lookup = Util.escape_globs(source)
                        lookup = config[:recursive] ? File.join(lookup, "**") : lookup
                        lookup = file_level_lookup(lookup)
                
                
                Severity: Minor
                Found in lib/thor/actions/directory.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 parse has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def parse(args) # rubocop:disable MethodLength
                      @pile = args.dup
                      @parsing_options = true
                
                      while peek
                Severity: Minor
                Found in lib/thor/parser/options.rb - About 1 hr to fix

                  Method print_options has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def print_options(shell, options, group_name = nil)
                          return if options.empty?
                  
                          list = []
                          padding = options.map { |o| o.aliases.size }.max.to_i * 4
                  Severity: Minor
                  Found in lib/thor/base.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 inside has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def inside(dir = "", config = {}, &block)
                        verbose = config.fetch(:verbose, false)
                        pretend = options[:pretend]
                  
                        say_status :inside, dir, verbose
                  Severity: Minor
                  Found in lib/thor/actions.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 print_table has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def print_table(array, options = {}) # rubocop:disable MethodLength
                          return if array.empty?
                  
                          formats = []
                          indent = options[:indent].to_i
                  Severity: Minor
                  Found in lib/thor/shell/basic.rb - About 1 hr to fix

                    Method thorfiles has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def thorfiles(relevant_to = nil, skip_lookup = false)
                        thorfiles = []
                    
                        unless skip_lookup
                          Pathname.pwd.ascend do |path|
                    Severity: Minor
                    Found in lib/thor/runner.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 create_command has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def create_command(meth) #:nodoc:
                          @usage ||= nil
                          @desc ||= nil
                          @long_desc ||= nil
                          @hide ||= nil
                    Severity: Minor
                    Found in lib/thor.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 run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def run(instance, args = [])
                          arity = nil
                    
                          if private_method?(instance)
                            instance.class.handle_no_command_error(name)
                    Severity: Minor
                    Found in lib/thor/command.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 usage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def usage(padding = 0)
                          sample = if banner && !banner.to_s.empty?
                            "#{switch_name}=#{banner}".dup
                          else
                            switch_name
                    Severity: Minor
                    Found in lib/thor/parser/option.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

                    Severity
                    Category
                    Status
                    Source
                    Language