File Bootloader.rb
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yast"
require "yast2/popup"
require "bootloader/exceptions"
require "bootloader/sysconfig"
require "bootloader/bootloader_factory"
Method modify_kernel_params
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def modify_kernel_params(*args)
ReadOrProposeIfNeeded() # ensure we have data to modify
current_bl = ::Bootloader::BootloaderFactory.current
# currently only grub2 bootloader supported
return :missing unless current_bl.respond_to?(:grub_default)
- 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 Read
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Read
log.info "Reading configuration"
# run Progress bar
stages = [
# progress stage, text in dialog (short, infinitiv)
Method modify_kernel_params
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def modify_kernel_params(*args)
ReadOrProposeIfNeeded() # ensure we have data to modify
current_bl = ::Bootloader::BootloaderFactory.current
# currently only grub2 bootloader supported
return :missing unless current_bl.respond_to?(:grub_default)
Method Write
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Write
ReadOrProposeIfNeeded()
mark_as_changed
Method Read
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def Read
log.info "Reading configuration"
# run Progress bar
stages = [
# progress stage, text in dialog (short, infinitiv)
- 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 ReadOrProposeIfNeeded
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def ReadOrProposeIfNeeded
current_bl = ::Bootloader::BootloaderFactory.current
return if current_bl.read? || current_bl.proposed?
if Mode.config || (Stage.initial && !Mode.update)
- 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 Write
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def Write
ReadOrProposeIfNeeded()
mark_as_changed
- 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
Avoid too many return
statements within this method. Open
return false