Falkor/falkorlib

View on GitHub
lib/falkorlib/git/base.rb

Summary

Maintainability
D
1 day
Test Coverage
C
71%

File base.rb has 332 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "falkorlib"
require "falkorlib/common"

require "minigit"
require "pathname"
Severity: Minor
Found in lib/falkorlib/git/base.rb - About 4 hrs to fix

    Method subtree_diff has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def subtree_diff(path = Dir.pwd)
          raise ArgumentError, "Git 'subtree' command is not available" unless FalkorLib::Git.command? "subtree"
          if FalkorLib.config.git[:subtrees].empty?
            FalkorLib::Git.config_warn(:subtrees)
            return 1
    Severity: Minor
    Found in lib/falkorlib/git/base.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 subtree_init has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def subtree_init(path = Dir.pwd)
          raise ArgumentError, "Git 'subtree' command is not available" unless FalkorLib::Git.command? "subtree"
          if FalkorLib.config.git[:subtrees].empty?
            FalkorLib::Git.config_warn(:subtrees)
            return 1
    Severity: Minor
    Found in lib/falkorlib/git/base.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 subtree_up has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def subtree_up(path = Dir.pwd)
          error "Unable to pull subtree(s): Dirty Git repository" if FalkorLib::Git.dirty?( path )
          exit_status = 0
          git_root_dir = rootdir(path)
          Dir.chdir(git_root_dir) do
    Severity: Minor
    Found in lib/falkorlib/git/base.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 submodule_init has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def submodule_init(path = Dir.pwd, submodules = FalkorLib.config.git[:submodules], _options = {})
          exit_status  = 1
          git_root_dir = rootdir(path)
          if File.exist?("#{git_root_dir}/.gitmodules")
            unless submodules.empty?
    Severity: Minor
    Found in lib/falkorlib/git/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 init has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def init(path = Dir.pwd, _options = {})
          # FIXME: for travis test: ensure the global git configurations
          # 'user.email' and 'user.name' are set
          [ 'user.name', 'user.email' ].each do |userconf|
            next unless MiniGit[userconf].nil?
    Severity: Minor
    Found in lib/falkorlib/git/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 config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def config(key, dir = Dir.pwd, options = {})
          #info "Retrieve the Git configuration"
          res = nil
          if (options[:list] || (key.is_a? Regexp) || (key =~ /\*/))
            cg  = MiniGit::Capturing.new(dir)
    Severity: Minor
    Found in lib/falkorlib/git/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

    There are no issues that match your filters.

    Category
    Status