Falkor/falkorlib

View on GitHub

Showing 62 of 64 total issues

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

    def write_from_erb_template(erbfile, outfile, config = {},
                                options = {
                                  :no_interaction => false
                                })
      erbfiles = (erbfile.is_a?(Array)) ? erbfile : [ erbfile ]
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 parse has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parse(moduledir = Dir.pwd, options = {
        :no_interaction => false
      })
        name = File.basename(moduledir)
        metadata = metadata(moduledir, :use_symbols => false,
Severity: Minor
Found in lib/falkorlib/puppet/modules.rb - About 1 hr to fix

    Method makefile has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def makefile(dir = Dir.pwd, options = {})
          path = normalized_path(dir)
          path = FalkorLib::Git.rootdir(path) if FalkorLib::Git.init?(path)
          info "=> Setup a root repository makefile in '#{dir}'"
          # Preparing submodule
    Severity: Minor
    Found in lib/falkorlib/bootstrap/base.rb - About 1 hr to fix

      Method root has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def root(dir = Dir.pwd, options = {})
              raise FalkorLib::ExecError "Not used in a Git repository" unless FalkorLib::Git.init?
              exit_status = 0
              path = normalized_path(dir)
              relative_path_to_root = (Pathname.new( FalkorLib::Git.rootdir(dir) ).relative_path_from Pathname.new( File.realpath(path)))
      Severity: Minor
      Found in lib/falkorlib/bootstrap/link.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 versionfile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def versionfile(dir = Dir.pwd, options = {})
            file    = (options[:file])    ? options[:file]    : 'VERSION'
            version = (options[:version]) ? options[:version] : '0.0.0'
            info " ==> bootstrapping a VERSION file"
            path = normalized_path(dir)
      Severity: Minor
      Found in lib/falkorlib/bootstrap/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 makefile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def makefile(dir = Dir.pwd, options = {})
            path = normalized_path(dir)
            path = FalkorLib::Git.rootdir(path) if FalkorLib::Git.init?(path)
            info "=> Setup a root repository makefile in '#{dir}'"
            # Preparing submodule
      Severity: Minor
      Found in lib/falkorlib/bootstrap/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 metadata has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def metadata(moduledir = Dir.pwd, options = {
              :use_symbols => true,
              :extras => true,
              :no_interaction => false
            })
      Severity: Minor
      Found in lib/falkorlib/puppet/modules.rb - About 1 hr to fix

        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 show_diff_and_write has 28 lines of code (exceeds 25 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 1 hr to fix

          Method upgrade has 28 lines of code (exceeds 25 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 1 hr to fix

            Method default has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def default
                  res = FalkorLib::Config::DEFAULTS.clone
                  $LOADED_FEATURES.each do |path|
                    res[:git]        = FalkorLib::Config::Git::DEFAULTS        if path.include?('lib/falkorlib/git.rb')
                    res[:gitflow]    = FalkorLib::Config::GitFlow::DEFAULTS    if path.include?('lib/falkorlib/git.rb')
            Severity: Minor
            Found in lib/falkorlib/config.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 parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                  def parse(moduledir = Dir.pwd, options = {
                    :no_interaction => false
                  })
                    name = File.basename(moduledir)
                    metadata = metadata(moduledir, :use_symbols => false,
            Severity: Minor
            Found in lib/falkorlib/puppet/modules.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

            Method normalized_path has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def normalized_path(dir = Dir.pwd, options = {})
                  rootdir = (FalkorLib::Git.init?(dir)) ? FalkorLib::Git.rootdir(dir) : dir
                  path = dir
                  path = Dir.pwd if dir == '.'
                  path = File.join(Dir.pwd, dir) unless (dir =~ /^\// || (dir == '.'))
            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 license has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def license(dir = Dir.pwd,
                            license = FalkorLib::Config::Bootstrap::DEFAULTS[:metadata][:license],
                            authors = '',
                            options = {
                              :filename     => 'LICENSE'
            Severity: Minor
            Found in lib/falkorlib/bootstrap/base.rb - About 55 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 upgrade_from_template has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def upgrade_from_template(moduledir = Dir.pwd,
                                            subdir = 'tests',
                                            options = {
                                              :no_interaction => false
                                            })
            Severity: Minor
            Found in lib/falkorlib/puppet/modules.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 write_from_template has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def write_from_template(src, dstdir, options = {
                  :no_interaction => false,
                  :no_commit      => false,
                  :srcdir         => '',
                  :outfile        => ''
            Severity: Minor
            Found in lib/falkorlib/common.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 command has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def command(name, type = 'feature', action = 'start', path = Dir.pwd, optional_args = '')
            Severity: Minor
            Found in lib/falkorlib/git/flow.rb - About 35 mins to fix

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

                  def init_rvm(rootdir = Dir.pwd, gemset = '')
                    rvm_files = {
                      :version => File.join(rootdir, '.ruby-version'),
                      :gemset  => File.join(rootdir, '.ruby-gemset')
                    }
              Severity: Minor
              Found in lib/falkorlib/common.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 command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def command(name, type = 'feature', action = 'start', path = Dir.pwd, optional_args = '')
                    error "Invalid git-flow type '#{type}'" unless %w(feature release hotfix support).include?(type)
                    error "Invalid action '#{action}'" unless %w(start finish).include?(action)
                    error "You must provide a name" if name == ''
                    error "The name '#{name}' cannot contain spaces" if name =~ /\s+/
              Severity: Minor
              Found in lib/falkorlib/git/flow.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