lib/observed/config_builder.rb
Method observe
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def observe(tag=nil, args={}, &block)
if tag.is_a? ::Hash
args = tag
tag = nil
end
Consider simplifying this complex logical expression. Open
Open
observer = if args[:via] || args[:using]
via = args[:via] || args[:using] ||
fail(RuntimeError, %Q|Missing observer plugin name for the tag "#{tag}" in "#{args}"|)
with = args[:with] || args[:which] || {}
plugin = observer_plugins[via] ||
Consider simplifying this complex logical expression. Open
Open
reporter = if args[:via] || args[:using]
via = args[:via] || args[:using]
with = args[:with] || args[:which] || {}
with = ({logger: @logger}).merge(with).merge({tag_pattern: tag_pattern, system: system})
plugin = reporter_plugins[via] ||
Consider simplifying this complex logical expression. Open
Open
translator = if args[:via] || args[:using]
#tag_pattern || fail("Tag pattern missing: #{tag_pattern} where args: #{args}")
via = args[:via] || args[:using]
with = args[:with] || args[:which] || {}
with = ({logger: logger}).merge(with).merge({system: system})
Method observe
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def observe(tag=nil, args={}, &block)
if tag.is_a? ::Hash
args = tag
tag = nil
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 report
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def report(tag_pattern=nil, args={}, &block)
if tag_pattern.is_a? ::Hash
args = tag_pattern
tag_pattern = nil
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"