Falkor/falkorlib

View on GitHub

Showing 62 of 64 total issues

Method latex has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
Open

    def latex(dir = Dir.pwd, type = :beamer, options = {})
      ap options if options[:debug]
      error "Unsupported type" unless [ :beamer, :article, :letter, :bookchapter ].include?( type )
      path   = normalized_path(dir)
      config = FalkorLib::Config::Bootstrap::DEFAULTS[:latex].clone
Severity: Minor
Found in lib/falkorlib/bootstrap/latex.rb - About 1 day 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 readme has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
Open

    def readme(dir = Dir.pwd, options = {})
      info "Bootstrap a README file for this project"
      path = normalized_path(dir)
      # get the local configuration
      local_config = FalkorLib::Config.get(dir)
Severity: Minor
Found in lib/falkorlib/bootstrap/base.rb - About 1 day 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 pyenv has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

    def pyenv(dir = Dir.pwd, options = {})
      info "Initialize Pyenv-virtualenv and direnv setup in '#{dir}'"
      ap options if options[:debug]
      path = normalized_path(dir)
      unless File.directory?(path)
Severity: Minor
Found in lib/falkorlib/bootstrap/python.rb - About 1 day 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 53 (exceeds 5 allowed). Consider refactoring.
Open

      def init(rootdir = Dir.pwd, name = '', _options = {})
        config = {}
        #login = `whoami`.chomp
        config[:name] = name unless name.empty?
        moduledir     = rootdir
Severity: Minor
Found in lib/falkorlib/puppet/modules.rb - About 1 day 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 52 (exceeds 5 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: Minor
Found in lib/falkorlib/git/flow.rb - About 1 day 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

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

require "falkorlib"
require "falkorlib/common"
require "falkorlib/bootstrap"

require 'erb' # required for module generation
Severity: Minor
Found in lib/falkorlib/bootstrap/base.rb - About 6 hrs to fix

    Method rvm has a Cognitive Complexity of 40 (exceeds 5 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: Minor
    Found in lib/falkorlib/bootstrap/ruby.rb - About 6 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 latex has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def latex(dir = Dir.pwd, type = :beamer, options = {})
          ap options if options[:debug]
          error "Unsupported type" unless [ :beamer, :article, :letter, :bookchapter ].include?( type )
          path   = normalized_path(dir)
          config = FalkorLib::Config::Bootstrap::DEFAULTS[:latex].clone
    Severity: Major
    Found in lib/falkorlib/bootstrap/latex.rb - About 5 hrs to fix

      Method repo has a Cognitive Complexity of 32 (exceeds 5 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: Minor
      Found in lib/falkorlib/bootstrap/git.rb - About 4 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 gitcrypt has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          def gitcrypt(dir = Dir.pwd, options = {})
            path = normalized_path(dir)
            unless File.directory?(path)
              warning "The directory '#{path}' does not exist yet."
              warning 'Do you want to create (and git init) this directory?'
      Severity: Minor
      Found in lib/falkorlib/bootstrap/git.rb - About 4 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 readme has 108 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def readme(dir = Dir.pwd, options = {})
            info "Bootstrap a README file for this project"
            path = normalized_path(dir)
            # get the local configuration
            local_config = FalkorLib::Config.get(dir)
      Severity: Major
      Found in lib/falkorlib/bootstrap/base.rb - About 4 hrs to fix

        Method pyenv has 100 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def pyenv(dir = Dir.pwd, options = {})
              info "Initialize Pyenv-virtualenv and direnv setup in '#{dir}'"
              ap options if options[:debug]
              path = normalized_path(dir)
              unless File.directory?(path)
        Severity: Major
        Found in lib/falkorlib/bootstrap/python.rb - About 4 hrs to fix

          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 set_version has a Cognitive Complexity of 26 (exceeds 5 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 3 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

            File common.rb has 313 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "falkorlib"
            require 'open3'
            require 'erb' # required for module generation
            require 'diffy'
            require 'json'
            Severity: Minor
            Found in lib/falkorlib/common.rb - About 3 hrs to fix

              File modules.rb has 312 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require "falkorlib"
              require "falkorlib/common"
              
              require "pathname"
              require 'json'
              Severity: Minor
              Found in lib/falkorlib/puppet/modules.rb - About 3 hrs to fix

                Method metadata has a Cognitive Complexity of 24 (exceeds 5 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 3 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 init has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def init(rootdir = Dir.pwd, name = '', _options = {})
                        config = {}
                        #login = `whoami`.chomp
                        config[:name] = name unless name.empty?
                        moduledir     = rootdir
                Severity: Major
                Found in lib/falkorlib/puppet/modules.rb - About 3 hrs to fix

                  Method motd has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def motd(dir = Dir.pwd, options = {})
                        config = FalkorLib::Config::Bootstrap::DEFAULTS[:motd].merge!(::ActiveSupport::HashWithIndifferentAccess.new(options).symbolize_keys)
                        path = normalized_path(dir)
                        erbfile = File.join( FalkorLib.templates, 'motd', 'motd.erb')
                        outfile = (config[:file] =~ /^\//) ? config[:file] : File.join(path, config[:file])
                  Severity: Minor
                  Found in lib/falkorlib/bootstrap/base.rb - About 3 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 gitcrypt has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def gitcrypt(dir = Dir.pwd, options = {})
                        path = normalized_path(dir)
                        unless File.directory?(path)
                          warning "The directory '#{path}' does not exist yet."
                          warning 'Do you want to create (and git init) this directory?'
                  Severity: Major
                  Found in lib/falkorlib/bootstrap/git.rb - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language