File routines.rb
has 497 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "shellwords"
module Yast
module NetworkRoutinesInclude
include I18n
Method ReadHardware
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def ReadHardware(hwtype)
hardware = []
Builtins.y2debug("hwtype=%1", hwtype)
- 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 ReadHardware
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ReadHardware(hwtype)
hardware = []
Builtins.y2debug("hwtype=%1", hwtype)
Method ControllerType
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ControllerType(hwdevice)
hwdevice = deep_copy(hwdevice)
return "modem" if Ops.get_string(hwdevice, "subclass", "") == "Modem"
return "isdn" if Ops.get_string(hwdevice, "subclass", "") == "ISDN"
return "dsl" if Ops.get_string(hwdevice, "subclass", "") == "DSL"
Method ControllerType
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def ControllerType(hwdevice)
hwdevice = deep_copy(hwdevice)
return "modem" if Ops.get_string(hwdevice, "subclass", "") == "Modem"
return "isdn" if Ops.get_string(hwdevice, "subclass", "") == "ISDN"
return "dsl" if Ops.get_string(hwdevice, "subclass", "") == "DSL"
- 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 PackagesInstall
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def PackagesInstall(packages)
packages = deep_copy(packages)
return :next if packages == []
log.info "Checking packages: #{packages}"
- 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 PackagesInstall
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def PackagesInstall(packages)
packages = deep_copy(packages)
return :next if packages == []
log.info "Checking packages: #{packages}"
Method filter_out
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def filter_out(device_info, driver)
# filter out device with virtio_pci Driver and no Device File (bnc#585506)
if driver == "virtio_pci" && (device_info["dev_name"] || "") == ""
log.info("Filtering out virtio device without device file.")
return true
- 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 ""
Avoid too many return
statements within this method. Open
return "lo"
Avoid too many return
statements within this method. Open
return "fddi"
Avoid too many return
statements within this method. Open
return "myri"
Avoid too many return
statements within this method. Open
return "modem"
Avoid too many return
statements within this method. Open
return "atm"
Avoid too many return
statements within this method. Open
return "ib"
Avoid too many return
statements within this method. Open
return "ficon"
Avoid too many return
statements within this method. Open
return "modem"
Avoid too many return
statements within this method. Open
return "fddi"
Avoid too many return
statements within this method. Open
return "xp"
Avoid too many return
statements within this method. Open
return "isdn"
Avoid too many return
statements within this method. Open
return "hsi"
Avoid too many return
statements within this method. Open
return "sit"
Avoid too many return
statements within this method. Open
return "tr"
Avoid too many return
statements within this method. Open
return "ib"
Avoid too many return
statements within this method. Open
return "xp"
Avoid too many return
statements within this method. Open
return "eth"
Avoid too many return
statements within this method. Open
return "wlan"
Avoid too many return
statements within this method. Open
return ""
Avoid too many return
statements within this method. Open
return "tr"
Avoid too many return
statements within this method. Open
return "iucv"
Avoid too many return
statements within this method. Open
return "hsi"
Avoid too many return
statements within this method. Open
return "qeth"
Avoid too many return
statements within this method. Open
return "usb"
Avoid too many return
statements within this method. Open
return ""
Avoid too many return
statements within this method. Open
return ""
Avoid too many return
statements within this method. Open
return "lcs"
Avoid too many return
statements within this method. Open
return "iucv"
Avoid too many return
statements within this method. Open
return "qeth"
Avoid too many return
statements within this method. Open
return "ctc"
Avoid too many return
statements within this method. Open
return "escon"
Avoid too many return
statements within this method. Open
return "usb" # #22739
Avoid too many return
statements within this method. Open
return "wlan"
Avoid too many return
statements within this method. Open
return "isdn"
Avoid too many return
statements within this method. Open
return "myri"
Avoid too many return
statements within this method. Open
return ""
Avoid too many return
statements within this method. Open
return ""
Avoid too many return
statements within this method. Open
return "ib" if Ops.get_integer(hwdevice, "class_id", -1) == 12 && (subclass_id == 6)
Avoid too many return
statements within this method. Open
return "dsl"
Avoid too many return
statements within this method. Open
return "ctc"
Avoid too many return
statements within this method. Open
return "escon"