ManageIQ/httpd_configmap_generator

View on GitHub

Showing 4 of 26 total issues

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

    def configure_sssd
      info_msg("Configuring SSSD Service")
      sssd = Sssd.new(opts)
      sssd.load(SSSD_CONFIG)

Severity: Minor
Found in lib/httpd_configmap_generator/ldap.rb - About 1 hr to fix

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

      def file_binary?(file)
        data = File.read(file)
        ascii = control = binary = total = 0
        data[0..512].each_byte do |c|
          total += 1
Severity: Minor
Found in lib/httpd_configmap_generator/base/file_helper.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 file_entry_spec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def file_entry_spec(source_file, target_file = nil, mode = nil)
      target_file = source_file.dup unless target_file
      unless mode
        stat = File.stat(source_file)
        file_owner = Etc.getpwuid(stat.uid).name
Severity: Minor
Found in lib/httpd_configmap_generator/base/config_map.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
      info_msg("Renaming mellon config files")
      Dir.chdir(SAML2_CONFIG_DIRECTORY) do
        Dir.glob("https_*.*") do |mellon_file|
          saml2_file = nil
Severity: Minor
Found in lib/httpd_configmap_generator/saml.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