ManageIQ/manageiq-appliance_console

View on GitHub

Showing 54 of 88 total issues

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

    def initialize_from_hash(hash)
      hash.each do |k, v|
        next if v.nil?
        setter = "#{k}="
        if self.respond_to?(setter)
Severity: Minor
Found in lib/manageiq/appliance_console/database_configuration.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 ask_for_uri has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def ask_for_uri(prompt, expected_scheme, opts = {})
      require 'uri'
      just_ask(prompt, nil, nil, 'a valid URI') do |q|
        q.validate = lambda do |a|
          # Convert all backslashes in the URI to forward slashes and strip whitespace
Severity: Minor
Found in lib/manageiq/appliance_console/prompts.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 ask_questions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def ask_questions
      clear_screen
      say("Establish Replication Standby Server\n")
      return false if !data_dir_empty? && !confirm_data_resync
      self.disk = ask_for_disk("Standby database disk")
Severity: Minor
Found in lib/manageiq/appliance_console/database_replication_standby.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 activate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def activate
      say("Configuring Replication Standby Server...")
      stop_postgres
      stop_repmgrd
      initialize_postgresql_disk if disk
Severity: Minor
Found in lib/manageiq/appliance_console/database_replication_standby.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 ask_questions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def ask_questions
      return false unless valid_environment?
      ask_for_parameters
      show_parameters
      return false unless agree("\nProceed? (Y/N): ")
Severity: Minor
Found in lib/manageiq/appliance_console/external_httpd_authentication.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 node_number_valid? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def node_number_valid?
      rec = record_for_node_number

      return true if rec.nil?
      node_state = rec["active"] ? "active" : "inactive"
Severity: Minor
Found in lib/manageiq/appliance_console/database_replication_standby.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 load_current has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.load_current
      require 'yaml'
      unless File.exist?(DB_YML)
        require 'fileutils'
        FileUtils.cp(DB_YML_TMPL, DB_YML) if File.exist?(DB_YML_TMPL)
Severity: Minor
Found in lib/manageiq/appliance_console/database_configuration.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 selected_verb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def selected_verb(key, flag)
      if EXT_AUTH_OPTIONS[key][:logic]
        flag ? "Enable" : "Disable"
      else
        flag ? "Disable" : "Enable"
Severity: Minor
Found in lib/manageiq/appliance_console/external_auth_options.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 ask_yn? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def ask_yn?(prompt, default = nil)
      ask("#{prompt}? (Y/N): ") do |q|
        q.default = default if default
        q.validate = ->(p) { (p.blank? && default) || %w(y n).include?(p.downcase[0]) }
        q.responses[:not_valid] = "Please provide yes or no."
Severity: Minor
Found in lib/manageiq/appliance_console/prompts.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 ask_questions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def ask_questions
        return false unless valid_environment?

        ask_for_parameters
        show_parameters
Severity: Minor
Found in lib/manageiq/appliance_console/message_configuration.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 fetch_from_server has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def fetch_from_server(src_file, dst_file)
        return if file_found?(dst_file)

        FileUtils.mkdir_p(dst_file.dirname) unless dst_file.dirname.directory?

Severity: Minor
Found in lib/manageiq/appliance_console/message_configuration_client.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 set_server_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def set_server_state
      case options[:server]
      when "start"
        EvmServer.start unless EvmServer.running?
      when "stop"
Severity: Minor
Found in lib/manageiq/appliance_console/cli.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 valid_environment? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def valid_environment?
        if already_configured?
          unconfigure if agree("\nAlready configured on this Appliance, Un-Configure first? (Y/N): ")
          return false unless agree("\nProceed with Configuration? (Y/N): ")
        end
Severity: Minor
Found in lib/manageiq/appliance_console/message_configuration.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 rename_mellon_configfiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def rename_mellon_configfiles
        debug_msg("Renaming mellon config files ...")
        Dir.chdir(SAML2_CONFIG_DIRECTORY) do
          Dir.glob("https_*.*") do |mellon_file|
            saml2_file =
Severity: Minor
Found in lib/manageiq/appliance_console/saml_authentication.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