Showing 5 of 5 total issues
File augeas_parser.rb
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "set"
require "augeas"
require "forwardable"
require "cfa/placer"
Method initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(key: nil, collection: nil, value_matcher: nil, &block)
@matcher = lambda do |element|
return false unless key_match?(element, key)
return false unless collection_match?(element, collection)
return false unless value_match?(element, value_matcher)
- 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 ==
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ==(other)
return false if self.class != other.class
other_data = other.data # do not compute again
data.each_with_index do |entry, index|
- 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 true
Method serialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def serialize(data)
require "cfa/augeas_parser/writer"
# open augeas without any autoloading and it should not touch disk and
# load lenses as needed only
root = load_path = nil
- 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"