thoughtbot/gitsh

View on GitHub

Showing 5 of 5 total issues

Class GitRepository has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class GitRepository
    def initialize(env, options={})
      @env = env
      @status_factory = options.fetch(:status_factory, Status)
    end
Severity: Minor
Found in lib/gitsh/git_repository.rb - About 2 hrs to fix

    Class Environment has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Environment
        DEFAULT_GIT_COMMAND = '/usr/bin/env git'.freeze
        DEFAULT_CONFIG_DIRECTORY = '/usr/local/etc/gitsh'.freeze
    
        attr_reader :input_stream, :output_stream, :error_stream, :config_directory
    Severity: Minor
    Found in lib/gitsh/environment.rb - About 2 hrs to fix

      Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def initialize(line_editor, prior_words, input, automaton, escaper)
      Severity: Minor
      Found in lib/gitsh/tab_completion/command_completer.rb - About 35 mins to fix

        Method delete_text has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.delete_text(*args)
              return if line_buffer.nil?
        
              if args.length.zero?
                beg = 0
        Severity: Minor
        Found in lib/gitsh/line_editor.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 read_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def read_command
                command = line_editor.readline(prompt, true)
                if command && command.match(BLANK_LINE_REGEX)
                  env.fetch('gitsh.defaultCommand') { 'status' }
                else
        Severity: Minor
        Found in lib/gitsh/input_strategies/interactive.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