coi-gov-pl/puppet-jboss

View on GitHub

Showing 18 of 32 total issues

File datasource.rb has 409 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative '../configuration'

# A class for JBoss datasource provider
module PuppetX::Coi::Jboss::Provider::Datasource
  include PuppetX::Coi::Jboss::Constants
Severity: Minor
Found in lib/puppet_x/coi/jboss/provider/datasource.rb - About 5 hrs to fix

    Class AbstractJbossCli has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class PuppetX::Coi::Jboss::Provider::AbstractJbossCli < Puppet::Provider
      include PuppetX::Coi::Jboss::Checks
      DEFAULT_SHELL_EXECUTOR = PuppetX::Coi::Jboss::Internal::Executor::ShellExecutor.new
    
      # Default constructor that will also initialize 3 external object, system_runner, compilator and command executor
    Severity: Minor
    Found in lib/puppet_x/coi/jboss/provider/abstract_jboss_cli.rb - About 2 hrs to fix

      Method ensure has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def ensure
          trace 'ensure'
      
          exists?
          if @data.nil?
      Severity: Minor
      Found in lib/puppet_x/coi/jboss/provider/confignode.rb - About 1 hr to fix

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

          def exists?
            trace 'exists?'
            if @clean
              return (not @data.nil?)
            end
        Severity: Minor
        Found in lib/puppet_x/coi/jboss/provider/confignode.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 ensure has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def ensure
            trace 'ensure'
        
            exists?
            if @data.nil?
        Severity: Minor
        Found in lib/puppet_x/coi/jboss/provider/confignode.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 exists? has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def exists?
            trace 'exists?'
            if @clean
              return (not @data.nil?)
            end
        Severity: Minor
        Found in lib/puppet_x/coi/jboss/provider/confignode.rb - About 1 hr to fix

          Method fetch_securtydomain_state has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def fetch_securtydomain_state
              data = @state
              fetched_state = PuppetX::Coi::Jboss::Internal::State::SecurityDomainState.new
              if data['security-domain'][(@resource[:name]).to_s]
                if data['security-domain'][(@resource[:name]).to_s]['cache-type'].nil?
          Severity: Minor
          Found in lib/puppet_x/coi/jboss/internal/securitydomain_auditor.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 resolve_state has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def resolve_state(actual_data, resource)
              @state = actual_data
              unless actual_data.key? 'security-domain'
                Puppet.debug('There is no securitydomain at all')
                return false
          Severity: Minor
          Found in lib/puppet_x/coi/jboss/internal/securitydomain_auditor.rb - About 1 hr to fix

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

                def read
                  map = nil
                  cfgfile = configfile
                  unless cfgfile.nil?
                    is_bool = lambda { |value| !/^(true|false)$/.match(value).nil? }
            Severity: Minor
            Found in lib/puppet_x/coi/jboss/configuration.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 properties has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def properties
                trace 'properties()'
            
                if @data.nil?
                  traceout 'properties()', {}
            Severity: Minor
            Found in lib/puppet_x/coi/jboss/provider/confignode.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 properties= has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def properties= newprops
                trace 'properties=(%s)' % newprops.inspect
            
                # Sorting by value to process `nil` values first
                sorted = newprops.sort do |a, b|
            Severity: Minor
            Found in lib/puppet_x/coi/jboss/provider/confignode.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

            Avoid too many return statements within this method.
            Open

                    return :disabled
            Severity: Major
            Found in lib/puppet_x/coi/jboss/provider/confignode.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return :enabled
              Severity: Major
              Found in lib/puppet_x/coi/jboss/provider/confignode.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return :present
                Severity: Major
                Found in lib/puppet_x/coi/jboss/provider/confignode.rb - About 30 mins to fix

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

                      def to_bool
                        str = if @target.respond_to?(:empty?)
                                @target
                              else
                                @target.to_s
                  Severity: Minor
                  Found in lib/puppet_x/coi/jboss/buildins_utils.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 prepare_resource has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def prepare_resource
                      @resource = {} if @resource.nil?
                      @resource[:name] = @property_hash[:name] if @resource[:name].nil?
                      @resource[:controller] = controller if @resource[:controller].nil?
                      @resource[:runasdomain] = runasdomain if @resource[:runasdomain].nil?
                  Severity: Minor
                  Found in lib/puppet_x/coi/jboss/provider/datasource.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_main_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def build_main_command
                      res = @resource
                      correct_cmd = correct_command_template_begining(res)
                      options = []
                      res[:moduleoptions].keys.sort.each do |key|
                  Severity: Minor
                  Found in lib/puppet_x/coi/jboss/provider/securitydomain/abstract_provider.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 servergroups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def servergroups
                      return @resource[:servergroups] unless @resource[:runasdomain]
                      return @servergroups unless @servergroups.nil?
                      state = execute("deployment-info --name=#{@resource[:name]}")
                      return [] unless state.success?
                  Severity: Minor
                  Found in lib/puppet_x/coi/jboss/provider/deploy.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