Showing 69 of 81 total issues
File grub2_widgets.rb
has 923 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yast"
require "bootloader/generic_widgets"
require "bootloader/device_map_dialog"
require "bootloader/serial_console"
Class Grub2Base
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class Grub2Base < BootloaderBase
include Yast::Logger
include Yast::I18n
# @!attribute password
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"
File grub2base.rb
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yast"
require "yast2/execute"
require "yast2/target_file" # adds ability to work with cfa in inst-sys
require "bootloader/bootloader_base"
require "bootloader/exceptions"
Class BootStorageClass
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class BootStorageClass < Module
include Yast::Logger
# Moint point for /boot. If there is not separated /boot, / is used instead.
# @return [Y2Storage::Filesystem]
File proposal_client.rb
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "installation/proposal_client"
require "bootloader/exceptions"
require "bootloader/main_dialog"
require "bootloader/bootloader_factory"
require "bootloader/systeminfo"
Class Systeminfo
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Systeminfo
class << self
include Yast::Logger
# Check current secure boot state.
File autoyast_converter.rb
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yast"
require "bootloader/bootloader_factory"
require "bootloader/cpu_mitigations"
Method DefaultKernelParams
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def DefaultKernelParams(resume)
features = ProductFeatures.GetStringFeature(
"globals",
"additional_kernel_parameters"
)
- 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
Class Stage1
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Stage1
extend Forwardable
include Yast::Logger
attr_reader :model
Method can_use_boot?
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def can_use_boot?
fs = Yast::BootStorage.boot_filesystem
# no boot assigned
return false unless fs
- 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 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)
Class DeviceMapDialog
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class DeviceMapDialog
include Yast::UIShortcuts
include Yast::I18n
def self.run(device_map)
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 execute
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def execute(devices: [], secure_boot: false, trusted_boot: false, update_nvram: true)
if secure_boot && !Systeminfo.secure_boot_available?(@grub2_name)
# There might be some secure boot setting left over when the
# bootloader had been switched.
# Simply ignore it when it is not applicable instead of raising an
- 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 export_default
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def export_default(res, default)
DEFAULT_BOOLEAN_MAPPING.each do |key, method|
val = default.public_send(method)
res[key] = val.enabled? ? "true" : "false" if val.defined?
end
- 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 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Write
ReadOrProposeIfNeeded()
mark_as_changed
Method basic_cmd
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def basic_cmd(secure_boot, trusted_boot, update_nvram)
if Systeminfo.shim_needed?(@grub2_name, secure_boot)
cmd = ["/usr/sbin/shim-install", "--config-file=/boot/grub2/grub.cfg"]
else
cmd = ["/usr/sbin/grub2-install", "--target=#{target}"]
- 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 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"