Falkor/falkorlib

View on GitHub

Showing 62 of 64 total issues

Method init has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def init(path = Dir.pwd, options = {})
      exit_status = FalkorLib::Git.init(path, options)
      unless command?('git-flow')
        # Check (mainly for Linux) if the command is not available under `/usr/lib/git-core`
        git_lib = '/usr/lib/git-core/'
Severity: Major
Found in lib/falkorlib/git/flow.rb - About 3 hrs to fix

    Method show_diff_and_write has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def show_diff_and_write(content, outfile, options = {
          :no_interaction => false,
          :json_pretty_format => false,
          :no_commit => false
        })
    Severity: Minor
    Found in lib/falkorlib/common.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 list_items has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def list_items(glob_pattern, options = {})
          list  = { 0 => 'Exit' }
          index = 1
          raw_list = { 0 => 'Exit' }
    
    
    Severity: Minor
    Found in lib/falkorlib/common.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_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 repo has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def repo(name, options = {})
          ap options if options[:debug]
          path    = normalized_path(name)
          project = File.basename(path)
          use_git = FalkorLib::Git.init?(path)
    Severity: Major
    Found in lib/falkorlib/bootstrap/git.rb - About 2 hrs to fix

      Method upgrade has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

            def upgrade(moduledir = Dir.pwd,
                        options = {
                          :no_interaction => false,
                          :only    => nil,
                          :exclude => []
      Severity: Minor
      Found in lib/falkorlib/puppet/modules.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 makefile has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

            def makefile(dir = Dir.pwd,
                         options = {
                           :no_interaction => false
                         })
              raise FalkorLib::ExecError "Not used in a Git repository" unless FalkorLib::Git.init?
      Severity: Minor
      Found in lib/falkorlib/bootstrap/link.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 rvm has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def rvm(dir = Dir.pwd, options = {})
            info "Initialize Ruby Version Manager (RVM)"
            ap options if options[:debug]
            path = normalized_path(dir)
            use_git = FalkorLib::Git.init?(path)
      Severity: Major
      Found in lib/falkorlib/bootstrap/ruby.rb - About 2 hrs to fix

        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 guess_project_config has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def guess_project_config(dir = Dir.pwd, options = {})
              path = normalized_path(dir)
              use_git = FalkorLib::Git.init?(path)
              rootdir = (use_git) ? FalkorLib::Git.rootdir(path) : path
              local_config = FalkorLib::Config.get(rootdir, :local)
        Severity: Minor
        Found in lib/falkorlib/bootstrap/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 vagrant has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def vagrant(dir = Dir.pwd, options = {})
              info "Initialize Vagrant (see https://www.vagrantup.com/)"
              path = normalized_path(dir)
              use_git = FalkorLib::Git.init?(path)
              rootdir = (use_git) ? FalkorLib::Git.rootdir(path) : path
        Severity: Minor
        Found in lib/falkorlib/bootstrap/vagrant.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 deps has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

              def deps(moduledir = Dir.pwd)
                name = File.basename( moduledir )
                error "The module #{name} does not exist" unless File.directory?( moduledir )
        
                result    = []
        Severity: Minor
        Found in lib/falkorlib/puppet/modules.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 makefile has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def makefile(dir = Dir.pwd,
                           options = {
                             :no_interaction => false
                           })
                raise FalkorLib::ExecError "Not used in a Git repository" unless FalkorLib::Git.init?
        Severity: Minor
        Found in lib/falkorlib/bootstrap/link.rb - About 1 hr to fix

          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 set_version has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def set_version(version, rootdir = Dir.pwd, options = {})
                exit_status = 0
                type    = (options[:type])    ? options[:type]    : FalkorLib.config[:versioning][:type]
                source  = (options[:source])  ? options[:source]  : FalkorLib.config[:versioning][:source][ type ]
                versionfile = File.join( rootdir, source[:filename] ) unless source[:filename].nil?
          Severity: Minor
          Found in lib/falkorlib/versioning.rb - About 1 hr to fix

            Method vagrant has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def vagrant(dir = Dir.pwd, options = {})
                  info "Initialize Vagrant (see https://www.vagrantup.com/)"
                  path = normalized_path(dir)
                  use_git = FalkorLib::Git.init?(path)
                  rootdir = (use_git) ? FalkorLib::Git.rootdir(path) : path
            Severity: Minor
            Found in lib/falkorlib/bootstrap/vagrant.rb - About 1 hr to fix

              Method guess_project_config has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def guess_project_config(dir = Dir.pwd, options = {})
                    path = normalized_path(dir)
                    use_git = FalkorLib::Git.init?(path)
                    rootdir = (use_git) ? FalkorLib::Git.rootdir(path) : path
                    local_config = FalkorLib::Config.get(rootdir, :local)
              Severity: Minor
              Found in lib/falkorlib/bootstrap/base.rb - About 1 hr to fix

                Method init_from_template has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def init_from_template(templatedir, rootdir, config = {},
                                           options = {
                                             :erb_exclude    => [],
                                             :no_interaction => false
                                           })
                Severity: Minor
                Found in lib/falkorlib/common.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 get_version has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_version(path = Dir.pwd, options = {})
                      rootdir = normalized_path(path)
                      version = (options[:default]) ? options[:default] : FalkorLib.config[:versioning][:default]
                      type    = (options[:type])    ? options[:type]    : FalkorLib.config[:versioning][:type]
                      source  = (options[:source])  ? options[:source]  : FalkorLib.config[:versioning][:source][ type ]
                Severity: Minor
                Found in lib/falkorlib/versioning.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

                Severity
                Category
                Status
                Source
                Language