Showing 26 of 32 total issues
Method match_files
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.match_files(guard, files)
return [] if files.empty?
files.inject([]) do |paths, file|
guard.watchers.each do |watcher|
- 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
Class PryWrapper
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class PryWrapper < Base
# The default Ruby script to configure Guard Pry if the option `:guard_rc`
# is not defined.
GUARD_RC = if ENV["XDG_CONFIG_HOME"] && File.exist?(ENV["XDG_CONFIG_HOME"] + "/guard/guardrc")
Class Engine
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Engine
extend Forwardable
include Internals::Helpers
# @private
Method notifiers
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def notifiers
supported = Notifier.supported
Notifier.connect(notify: true, silent: true)
detected = Notifier.detected
Notifier.disconnect
- 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
Class Session
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Session
attr_reader :plugins, :groups
DEFAULT_OPTIONS = {
clear: false,
Method show
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def show
objects = []
empty_plugin = ["", { "" => nil }]
guardfile_result.groups.each do |group_name, options|
- 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 run_on_changes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def run_on_changes(modified, added, removed)
types = {
MODIFICATION_TASKS => modified,
ADDITION_TASKS => added,
REMOVAL_TASKS => 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 clear
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def clear(opts = {})
return unless engine
return unless engine.session.clear?
fail "UI not set up!" if clearable.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"
Further reading
Method show
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
objects = []
empty_plugin = ["", { "" => nil }]
guardfile_result.groups.each do |group_name, options|
Method color_enabled?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def color_enabled?
@color_enabled_initialized ||= false
@color_enabled = nil unless @color_enabled_initialized
@color_enabled_initialized = true
return @color_enabled unless @color_enabled.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"
Further reading
Method notifiers
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def notifiers
supported = Notifier.supported
Notifier.connect(notify: true, silent: true)
detected = Notifier.detected
Notifier.disconnect
Method initialize_guardfile
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize_guardfile(
plugin_names = [],
evaluator: Guardfile::Evaluator.new(options),
generator: Guardfile::Generator.new
)
- 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 logger
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def logger(options)
logger_options = options.dup
if logger_options.key?(:level)
level = logger_options.delete(:level).to_sym
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def start
setup
_initialize_listener
_initialize_signal_traps
- 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 plugin_class
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def plugin_class
const = _plugin_constant
fail TypeError, "no constant: #{_constant_name}" unless const
@plugin_class ||= Guard.const_get(const)
- 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 pause
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def pause(expected = nil)
states = { paused: true, unpaused: false, toggle: !paused? }
key = expected || :toggle
raise ArgumentError, "invalid mode: #{expected.inspect}" unless states.key?(key)
- 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 color
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def color(text, *color_options)
color_code = ""
color_options.each do |color_option|
color_option = color_option.to_s
next if color_option == ""
- 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 _add_row
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _add_row(rows, name, available, used, option, value)
Method group
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def group(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
group = args.pop.to_sym
if block_given?
- 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 match
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def match(file)
_watches.map do |expr, block|
next unless (match = file.match(expr))
block.nil? ? [file] : block.call([file] + match.captures)
- 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"