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",
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}]"
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'
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'
- Read upRead up
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'
- Read upRead up
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'
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)
Avoid too many return
statements within this method. Open
return 'libphp5-zts.so' if module_name == 'php-zts'
Avoid too many return
statements within this method. Open
return '2.4' if node['platform_family'] == 'suse'
Avoid too many return
statements within this method. Open
return '2.4' if node['platform'] == 'amazon'
Avoid too many return
statements within this method. Open
return '2.4' if node['platform'] == 'ubuntu'
Avoid too many return
statements within this method. Open
return '2.4' if node['platform_family'] == 'rhel' && node['platform_version'].to_i >= 7
Avoid too many return
statements within this method. Open
return '2.4' if node['platform_family'] == 'freebsd'
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
- Read upRead up
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"