Showing 18 of 18 total issues
Method change
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.change(record, rel_path)
path = Pathname.new(record.root) + rel_path
lstat = path.lstat
data = { mtime: lstat.mtime.to_f, mode: lstat.mode, size: lstat.size }
- 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 start
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def start
logger.info 'Starting listen...'
directory = @options[:directory]
relative = @options[:relative]
- 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 scan
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.scan(snapshot, rel_path, options)
record = snapshot.record
dir = Pathname.new(record.root)
previous = record.dir_entries(rel_path)
- 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 change
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.change(record, rel_path)
path = Pathname.new(record.root) + rel_path
lstat = path.lstat
data = { mtime: lstat.mtime.to_f, mode: lstat.mode, size: lstat.size }
Method scan
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.scan(snapshot, rel_path, options)
record = snapshot.record
dir = Pathname.new(record.root)
previous = record.dir_entries(rel_path)
Method invalidate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def invalidate(type, rel_path, options)
watched_dir = Pathname.new(record.root)
change = options[:change]
cookie = options[:cookie]
- 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 _process_event
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _process_event(dir, event)
# NOTE: avoid using event.absolute_name since new API
# will need to have a custom recursion implemented
# to properly match events to configured directories
path = Pathname.new(event.watcher.path) + event.name
- 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 dir_entries
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dir_entries(rel_path)
rel_path_s = rel_path.to_s
subtree = if empty_dirname?(rel_path_s)
@tree
else
- 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 <<(args)
type, change, dir, path, options = *args
fail "Invalid type: #{type.inspect}" unless [:dir, :file].include? type
fail "Invalid change: #{change.inspect}" unless change.is_a?(Symbol)
fail "Invalid path: #{path.inspect}" unless path.is_a?(String)
- 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 _calculate_add_remove_difference
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _calculate_add_remove_difference(actions, path, default_if_exists)
added = actions.count { |x| x == :added }
removed = actions.count { |x| x == :removed }
diff = added - removed
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
listener,
event_queue,
queue_optimizer,
wait_for_delay,
&block
Avoid too many return
statements within this method. Open
return if /1|true/ =~ ENV['LISTEN_GEM_DISABLE_HASHING']
Avoid too many return
statements within this method. Open
return unless inaccurate_mac_time?(lstat)
Avoid too many return
statements within this method. Open
return if data[:mtime].to_i + 2 <= Time.now.to_f
Method _process_event
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _process_event(dir, event)
Listen.logger.debug "wdm - callback: #{event.inspect}"
type, change = event
- 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 validate_and_sanitize_new_state
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_and_sanitize_new_state(new_state_name)
return nil if @state == new_state_name
if current_state && !current_state.valid_transition?(new_state_name)
valid = current_state.transitions.map(&:to_s).join(', ')
- 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 stop
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def stop
while (listener = @listeners.deq(true))
begin
listener.stop
rescue WeakRef::RefError
- 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 editor_modified?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def editor_modified?(changes)
return unless changes.size == 2
from_type = from = nil
to_type = to_dir = to = 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"