lib/relaton_itu/editorial_group.rb
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def initialize(bureau:, group:, subgroup: nil, workgroup: nil)
unless BUREAUS.include? bureau
Util.warn "WARNING: Invalid bureau: `#{bureau}`"
Util.warn "WARNING: Valid bureaus are: `#{BUREAUS.join('`, `')}`"
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 to_xml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def to_xml(builder) # rubocop:disable Metrics/AbcSize
builder.editorialgroup do
builder.bureau bureau
builder.group { |b| group.to_xml b } if group
builder.subgroup { |b| group.to_xml b } if subgroup
- 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"