hannesg/multi_git

View on GitHub

Showing 32 of 36 total issues

Avoid deeply nested control flow statements.
Open

              if symlinks.include? entry
                # We have already seen this symlink
                #TODO: it's okay to see a symlink twice if requested
                raise MultiGit::Error::CyclicSymlink, "Cyclic symlink detected while traversing #{path} from #{self.inspect}."
              else
Severity: Major
Found in lib/multi_git/tree.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                  if follow
                    parts.push(*entry.target.split(SLASH))
                  else
                    if parts.none?
                      return entry
    Severity: Major
    Found in lib/multi_git/tree.rb - About 45 mins to fix

      Method each_branch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def each_branch(filter = :all)
            return to_enum(:each_branch, filter) unless block_given?
            which = case filter
                    when :all, Regexp then [:a]
                    when :local       then []
      Severity: Minor
      Found in lib/multi_git/git_backend/repository.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 >> has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def >>(repository)
            ent = []
            dirty_entries.each do |name, entry|
              if entry
                object = repository.write(entry)
      Severity: Minor
      Found in lib/multi_git/tree/builder.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 [] has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def [](*args)
              forced = false
              if args.last.kind_of? Hash
                options = args.pop.dup
                forced = options.delete(:forced){ false }
      Severity: Minor
      Found in lib/multi_git/refspec.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 parse_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_string(string, forced)
              if ma = REF.match(string)
                if ma[2]
                  from = normalize(from_base, ma[2])
                end
      Severity: Minor
      Found in lib/multi_git/refspec.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 remote has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def remote( name_or_url )
            if looks_like_remote_url? name_or_url
              remote = Rugged::Remote.new(__backend__, name_or_url)
            else
              remote = Rugged::Remote.lookup(__backend__, name_or_url)
      Severity: Minor
      Found in lib/multi_git/rugged_backend/repository.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

      Avoid too many return statements within this method.
      Open

                return true
      Severity: Major
      Found in lib/multi_git/tree/builder.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return new != old
        Severity: Major
        Found in lib/multi_git/tree/builder.rb - About 30 mins to fix

          Method call_env has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def call_env(env, *args, &block)
                s = cmd(*args)
                block ||= READ_BLOCK
                result = nil
                message = nil
          Severity: Minor
          Found in lib/multi_git/git_backend/cmd.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

          Method each_explicit_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def each_explicit_key
                  return to_enum(:each_explicit_key) unless block_given?
                  seen = Set.new
                  @cmd.('config','--list') do |io|
                    io.each_line do |line|
          Severity: Minor
          Found in lib/multi_git/git_backend/config.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

          Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def initialize(path, options = {})
                options = initialize_options(path,options)
                builder = Java::OrgEclipseJgitStorageFile::FileRepositoryBuilder.new
                builder.setGitDir(Java::JavaIO::File.new(options[:repository]))
                if options[:working_directory]
          Severity: Minor
          Found in lib/multi_git/jgit_backend/repository.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