kigster/warp-dir

View on GitHub

Showing 19 of 19 total issues

Method add has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def add(point: nil,
              point_name: nil,
              point_path: nil,
              overwrite: false)
        unless point
Severity: Minor
Found in lib/warp/dir/store.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 run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def run(*args)
    self.shell_init_files = config[:dotfile].split(',') if config[:dotfile]
    self.shell_init_files.any? { |dotfile| append_wrapper_to(dotfile) }

    # Overwrites if already there
Severity: Minor
Found in lib/warp/dir/command/install.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 add has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def add(point: nil,
              point_name: nil,
              point_path: nil,
              overwrite: false)
        unless point
Severity: Minor
Found in lib/warp/dir/store.rb - About 1 hr to fix

    Method run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def run(*args)
        self.shell_init_files = config[:dotfile].split(',') if config[:dotfile]
        self.shell_init_files.any? { |dotfile| append_wrapper_to(dotfile) }
    
        # Overwrites if already there
    Severity: Minor
    Found in lib/warp/dir/command/install.rb - About 1 hr to fix

      Method inherited has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def inherited(subclass)
                ::Warp::Dir::Commander.instance.register(subclass)
                subclass.class_eval do
                  extend Forwardable
                  def_delegators :@klazz, :command_name, :help, :description
      Severity: Minor
      Found in lib/warp/dir/command.rb - About 1 hr to fix

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

                def process_command
                  argv = self.argv
                  if config.command
                    command_class = commander.find(config.command)
                    if command_class
        Severity: Minor
        Found in lib/warp/dir/app/cli.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 color has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def color(color_name)
              return '' if String.colors_disabled
              background = color_name.to_s =~ /on_/
              color_name = color_name.to_s.sub('on_', '')
              return unless color_name && COLORS[color_name]
        Severity: Minor
        Found in lib/colored.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 find_point has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def find_point(name_or_point)
                return if name_or_point.nil?
                result = if name_or_point.is_a?(Warp::Dir::Point)
                           self.find_point(name_or_point.name)
                         else
        Severity: Minor
        Found in lib/warp/dir/store.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 print has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                  def print(msg)
                    under_shell = ::Warp::Dir.eval_context?
                    if msg == ' '
                      under_shell ? stream.printf(%Q{printf '\\n'; }) : stream.printf("\n")
                    else
        Severity: Minor
        Found in lib/warp/dir/app/response.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def validate
                  self.validated = false
                  no_arguments   = argv.empty?
                  commands       = shift_non_flag_commands
                  self.opts      = parse_with_slop(self.argv)
        Severity: Minor
        Found in lib/warp/dir/app/cli.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 restore! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def restore!
                  unless File.exist?(warprc_file_path)
                    $stderr.puts "No warprc file found in the path #{warprc_file_path}" if config.debug
                    return
                  end
        Severity: Minor
        Found in lib/warp/dir/serializer/dotfile.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 type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def type(a_type = nil)
                  if a_type
                    @type = a_type.kind_of?(Warp::Dir::App::Response::Type) ? a_type : RETURN_TYPE[a_type]
                    raise(::ArgumentError.new("Can't find response type #{a_type} #{@type}")) unless @type
                    self
        Severity: Minor
        Found in lib/warp/dir/app/response.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def run(&block)
                  validate unless validated?
                  response = process_command
                  yield response if block_given?
                  response
        Severity: Minor
        Found in lib/warp/dir/app/cli.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def run(*args)
                  if point.nil? && point_name
                    begin
                      self.point = store[point_name]
                    rescue ::Warp::Dir::Errors::PointNotFound
        Severity: Minor
        Found in lib/warp/dir/command/warp.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 reindex! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def reindex!
                commands.each do |command|
                  if command.respond_to?(:aliases)
                    command.aliases.each do |an_alias|
                      if self.command_map[an_alias] && !self.command_map[an_alias] == command
        Severity: Minor
        Found in lib/warp/dir/commander.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def initialize(store, point_name = nil, point_path = nil)
                @store     = store
                @formatter = ::Warp::Dir::Formatter.new(@store)
                @klazz     = self.class
                if point_name
        Severity: Minor
        Found in lib/warp/dir/command.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 aliases has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                      def aliases(*args)
                        if args
                          @aliases << args unless !args || args.empty?
                          @aliases.flatten!
                        end
        Severity: Minor
        Found in lib/warp/dir/command.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 unhappy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def unhappy(exception: nil, message: nil)
                out = 'Whoops! – '.white
                out << "#{exception.message} ".red if exception && !message
                out << "#{message} ".red if !exception && message
                out << "#{exception.message}:\n#{message}".red if message && exception
        Severity: Minor
        Found in lib/warp/dir/formatter.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def run(opts, *flags)
                  point         = store.find_point(point_name)
                  $stderr.puts "FLAGS: [#{flags}]".bold.green if config.debug
        
                  command_flags = if flags && !flags.empty?
        Severity: Minor
        Found in lib/warp/dir/command/ls.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

        Severity
        Category
        Status
        Source
        Language