Falkor/falkorlib

View on GitHub
lib/falkorlib/puppet/modules.rb

Summary

Maintainability
F
3 days
Test Coverage
B
87%

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

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

            There are no issues that match your filters.

            Category
            Status