Method ReadFile
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def ReadFile(file, pathname)
Builtins.y2milestone("path=%1", pathname)
lines = []
if Ops.greater_than(SCR.Read(path(".target.size"), pathname), 0)
value = Convert.to_string(SCR.Read(path(".target.string"), pathname))
- 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 ReadFile
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ReadFile(file, pathname)
Builtins.y2milestone("path=%1", pathname)
lines = []
if Ops.greater_than(SCR.Read(path(".target.size"), pathname), 0)
value = Convert.to_string(SCR.Read(path(".target.string"), pathname))
File AsciiFile.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yast"
module Yast
# Assume this /etc/fstab file
#
Method AssertLineValid
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def AssertLineValid(file, line)
if Builtins.haskey(Ops.get_map(file.value, "l", {}), line) &&
Ops.get_boolean(file.value, ["l", line, "buildline"], false)
delim = Builtins.substring(
Ops.get_string(file.value, "delim", " "),
Method ChangeLineField
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ChangeLineField(file, line, field, entry)
Builtins.y2debug("line %1 field %2 entry %3", line, field, entry)
changed = false
if !Builtins.haskey(Ops.get_map(file.value, "l", {}), line)
Ops.set(file.value, ["l", line], {})
Method ChangeLineField
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def ChangeLineField(file, line, field, entry)
Builtins.y2debug("line %1 field %2 entry %3", line, field, entry)
changed = false
if !Builtins.haskey(Ops.get_map(file.value, "l", {}), line)
Ops.set(file.value, ["l", line], {})
- 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 AssertLineValid
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def AssertLineValid(file, line)
if Builtins.haskey(Ops.get_map(file.value, "l", {}), line) &&
Ops.get_boolean(file.value, ["l", line, "buildline"], false)
delim = Builtins.substring(
Ops.get_string(file.value, "delim", " "),
- 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"