Showing 7 of 11 total issues
Method fancy_extension
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def fancy_extension
arch = node['kernel']['machine']
if platform_family?('rhel')
identifier = "el#{node['platform_version'].to_i}"
"#{identifier}.#{arch}.rpm"
- 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 action_run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def action_run
requested_package_version = new_resource.package_version.split('-').first
return if chef_version.satisfies?(">= #{requested_package_version}")
notifying_block do
location = remote_file new_resource.fancy_basename do
- 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 action_run
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def action_run
requested_package_version = new_resource.package_version.split('-').first
return if chef_version.satisfies?(">= #{requested_package_version}")
notifying_block do
location = remote_file new_resource.fancy_basename do
Avoid too many return
statements within this method. Open
return platform_version
Avoid too many return
statements within this method. Open
return platform_version
Avoid too many return
statements within this method. Open
return '2012r2'
Method fancy_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fancy_path
platform = platform_family?('rhel') ? 'el' : node['platform']
url_version = get_url_version(platform, node['platform_version'])
major = package_version.split('.')[0].to_i
minor = package_version.split('.')[1].to_i
- 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"