hannesg/multi_git

View on GitHub

Showing 36 of 36 total issues

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

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

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

        def write(content, type = :blob)
          if content.kind_of? MultiGit::Builder
            return content >> self
          end
          validate_type(type)
    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 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

    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 [] 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

    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

      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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

              def make_inner(*args)
                if args.any?
                  if args[0].kind_of? Blob::Builder
                    return args[0]
                  elsif args[0].kind_of? Blob
        Severity: Minor
        Found in lib/multi_git/symlink.rb and 1 other location - About 30 mins to fix
        lib/multi_git/file.rb on lines 21..29

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 32.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

              def make_inner(*args)
                if args.any?
                  if args[0].kind_of? Blob::Builder
                    return args[0]
                  elsif args[0].kind_of? Blob
        Severity: Minor
        Found in lib/multi_git/file.rb and 1 other location - About 30 mins to fix
        lib/multi_git/symlink.rb on lines 25..33

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 32.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        if best_available == MultiGit::JGitBackend
          puts "You can now use jgit!"
          puts 
          puts "To show you that it actually works, here is a list of files in main folder:"
          repo = MultiGit.open('../../')
        Severity: Minor
        Found in examples/jgit/test.rb and 1 other location - About 25 mins to fix
        examples/rugged/test.rb on lines 5..15

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 31.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        if best_available == MultiGit::RuggedBackend
          puts "You can now use rugged!"
          puts 
          puts "To show you that it actually works, here is a list of files in main folder:"
          repo = MultiGit.open('../../')
        Severity: Minor
        Found in examples/rugged/test.rb and 1 other location - About 25 mins to fix
        examples/jgit/test.rb on lines 5..15

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 31.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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

        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 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

        Severity
        Category
        Status
        Source
        Language