File Lan.rb
has 577 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yast"
require "cfa/sysctl_config"
require "network/network_autoyast"
require "network/confirm_virt_proposal"
require "network/wicked"
Class LanClass
has 46 methods (exceeds 20 allowed). Consider refactoring. Open
class LanClass < Module
include ::UI::TextHelpers
include Wicked
def main
Method Read
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def Read(cache)
if cache == :cache && @initialized
Builtins.y2milestone("Using cached data")
return true
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 Read
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Read(cache)
if cache == :cache && @initialized
Builtins.y2milestone("Using cached data")
return true
end
Method Write
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def Write(gui: true, apply_config: !write_only)
log.info("Writing configuration")
# Query modified flag in all components
if !Modified()
- 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 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Write(gui: true, apply_config: !write_only)
log.info("Writing configuration")
# Query modified flag in all components
if !Modified()
Method Packages
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def Packages
backend = if Mode.autoinst
Y2Network::Backend.all.find { |b| b.id == proposal_settings.current_backend }
else
yast_config&.backend
- 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 main
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main
Yast.import "UI"
textdomain "network"
Yast.import "Arch"
Method writeIPv6
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def writeIPv6
log.info("writeIPv6: IPv6 is #{@ipv6 ? "enabled" : "disabled"}")
sysctl_config_file = CFA::SysctlConfig.new
sysctl_config_file.load
sysctl_config_file.disable_ipv6 = !@ipv6
- 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 activate_network_service
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def activate_network_service
# If the second installation stage has been called by yast.ssh via
# ssh, we should not restart network because systemctl
# hangs in that case. (bnc#885640)
action = :reload_restart if Stage.normal || !Linuxrc.usessh
- 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 isAnyInterfaceDown
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def isAnyInterfaceDown
down = false
link_status = devices_link_status
log.info("link_status #{link_status}")
- 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 link_status
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def link_status(name)
addr_show = ["/usr/sbin/ip", "address", "show", name]
inet_link = ["grep", "inet\\|link"]
row = Yast::Execute.stdout.on_target!(addr_show, inet_link).split("\n").map(&:strip)
addr = false
- 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 if Abort()
Avoid too many return
statements within this method. Open
return false if Abort()
Avoid too many return
statements within this method. Open
return false if Abort()
Avoid too many return
statements within this method. Open
return true if Host.GetModified
Avoid too many return
statements within this method. Open
return false if Abort()
Avoid too many return
statements within this method. Open
return false if Abort()
Avoid too many return
statements within this method. Open
return false if Abort()
Avoid too many return
statements within this method. Open
return false if Abort()
Avoid too many return
statements within this method. Open
return false if Abort()
Avoid too many return
statements within this method. Open
return false if Abort()
Avoid too many return
statements within this method. Open
return false unless read_config
Avoid too many return
statements within this method. Open
return false if Abort()
Avoid too many return
statements within this method. Open
return false if Abort()
Avoid too many return
statements within this method. Open
return false if !Popup.ContinueCancel(msg)
Avoid too many return
statements within this method. Open
return false if Abort()
Avoid too many return
statements within this method. Open
return false if !@gui
Method ensure_network_running
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ensure_network_running
network = false
timeout = NM_DHCP_TIMEOUT
while timeout > 0
if NetworkService.isNetworkRunning
- 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 Modified
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def Modified
return true if @modified
return true unless system_config == yast_config
return true if NetworkConfig.Modified
return true if NetworkService.Modified
- 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"