chef-cookbooks/httpd

View on GitHub

Showing 14 of 35 total issues

File info_module_packages.rb has 329 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module HttpdCookbook
  module Helpers
    module ModuleInfoDSL
      # create big crash hash with other hashes as keys
      # {:platform=>"amazon", :httpd_version=>"2.4", :module=>"rev"}=>"mod_revocator",
Severity: Minor
Found in libraries/info_module_packages.rb - About 3 hrs to fix

    Method create_setup_service has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def create_setup_service
            httpd_module 'systemd' do
              httpd_version new_resource.version
              instance new_resource.instance
              notifies :reload, "service[#{apache_name}]"
    Severity: Minor
    Found in libraries/httpd_service_rhel_systemd.rb - About 2 hrs to fix

      Method create_setup_service has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def create_setup_service
              directory "/run/#{apache_name}" do
                owner 'root'
                group 'root'
                mode '0755'
      Severity: Minor
      Found in libraries/httpd_service_debian_systemd.rb - About 1 hr to fix

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

            def default_apache_version
              return '2.2' if node['platform_family'] == 'debian' && node['platform_version'].to_i == 7
              return '2.2' if node['platform_family'] == 'rhel' && node['platform_version'].to_i == 6
              return '2.4' if node['platform_family'] == 'debian' && node['platform_version'].to_i >= 8
              return '2.4' if node['platform_family'] == 'fedora'
        Severity: Minor
        Found in libraries/helpers.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 default_filename has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def default_filename
              case node['platform_family']
              when 'debian'
                return 'libphp5.so' if module_name == 'php5'
              when 'rhel'
        Severity: Minor
        Found in libraries/httpd_module.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 create_setup_service has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def create_setup_service
                template "/etc/init.d/#{apache_name}" do
                  source "#{new_resource.version}/sysvinit/el-#{elversion}/httpd.erb"
                  owner 'root'
                  group 'root'
        Severity: Minor
        Found in libraries/httpd_service_rhel_sysvinit.rb - About 1 hr to fix

          Method package_name_for_module has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def package_name_for_module(name, httpd_version, platform, platform_family, platform_version)
          Severity: Minor
          Found in libraries/info_module_packages.rb - About 35 mins to fix

            Avoid too many return statements within this method.
            Open

                  return '2.4' if node['platform_family'] == 'rhel' && node['platform_version'].to_i >= 7
            Severity: Major
            Found in libraries/helpers.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return '2.4' if node['platform'] == 'ubuntu'
              Severity: Major
              Found in libraries/helpers.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return '2.4' if node['platform'] == 'amazon'
                Severity: Major
                Found in libraries/helpers.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return '2.4' if node['platform_family'] == 'suse'
                  Severity: Major
                  Found in libraries/helpers.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return 'libphp5-zts.so' if module_name == 'php-zts'
                    Severity: Major
                    Found in libraries/httpd_module.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                            return '2.4' if node['platform_family'] == 'freebsd'
                      Severity: Major
                      Found in libraries/helpers.rb - About 30 mins to fix

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

                            def platform_version_key(platform, platform_family, platform_version)
                              return platform_version.to_i.to_s if platform_family == 'rhel' && platform != 'amazon'
                              return platform_version.to_i.to_s if platform_family == 'debian' && !(platform == 'ubuntu' || platform_version =~ /sid$/)
                              return platform_version.to_i.to_s if platform_family == 'freebsd'
                              platform_version
                        Severity: Minor
                        Found in libraries/info_module_packages.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