bstopp/puppet-aem

View on GitHub

Showing 30 of 38 total issues

Method find_package has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def find_package
    client = build_client

    path = "/etc/packages/#{@resource[:group]}/#{@resource[:pkg]}-.zip"
    begin
Severity: Minor
Found in lib/puppet/provider/aem_crx_package/ruby.rb - About 1 hr to fix

    Method build_client has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def build_client
    
        return @client if @client
    
        port = nil
    Severity: Minor
    Found in lib/puppet/provider/aem_crx_package/ruby.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 read_env has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def read_env(hash)
    
        File.foreach(File.join(build_bin_dir, @start_env_file)) do |line|
    
          match = line.match(@port_regex) || nil
    Severity: Minor
    Found in lib/puppet/provider/aem_installer/default.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 insync? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def insync?(is_val)
          return false unless should.respond_to?(:keys) && is_val.respond_to?(:keys)
    
          case resource[:handle_missing]
          when :ignore
    Severity: Minor
    Found in lib/puppet/type/aem_sling_resource.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 found_to_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def found_to_hash(line)
        line.strip!
        hash = @resource.to_hash.dup
        hash.delete(:ensure)
    
    
    Severity: Minor
    Found in lib/puppet/provider/aem_installer/default.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 deep_merge_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def deep_merge_hash(to, from)
        # Pulled straight from Stack Overflow; don't ask me to to explain it.
        # http://stackoverflow.com/questions/9381553/ruby-merge-nested-hash
        merger = lambda do |_key, v1, v2|
          if v1.is_a?(Hash) && v2.is_a?(Hash)
    Severity: Minor
    Found in lib/puppet/provider/aem_sling_resource/ruby.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 find_version has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def find_version(ary)
        found_pkg = nil
        ary&.each do |p|
          found_pkg = p if p.version == @resource[:version]
          break if found_pkg
    Severity: Minor
    Found in lib/puppet/provider/aem_crx_package/ruby.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 build_parameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def build_parameters
        params = {}
        if @property_flush[:ensure] == :absent
          params = params.merge(':operation' => 'delete')
        else
    Severity: Minor
    Found in lib/puppet/provider/aem_sling_resource/ruby.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

    Method post_to_cfgmgr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def post_to_cfgmgr(configuration)
    
        pid = resource[:pid] || resource[:name]
    
        uri = URI("#{config_mgr_uri}/#{pid}")
    Severity: Minor
    Found in lib/puppet/provider/aem_osgi_config/ruby.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

    Method build_cfg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def build_cfg(port = nil, context_root = nil)
        config = CrxPackageManager::Configuration.new
        config.configure do |c|
          c.username = @resource[:username]
          c.password = @resource[:password]
    Severity: Minor
    Found in lib/puppet/provider/aem_crx_package/ruby.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