Skip to content

Commit

Permalink
Fix Rubocop linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexB52 committed Nov 29, 2023
1 parent 6a1ac46 commit 721f843
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ Style/NumericLiterals:
MinDigits: 9
Style/NumericPredicate:
Enabled: false
Style/MixinUsage:
Enabled: false
Style/OneLineConditional:
Enabled: false
Style/OptionalBooleanParameter:
Expand Down
2 changes: 1 addition & 1 deletion lib/listen/adapter/bsd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module Listen
module Adapter
class BSD < Base
OS_REGEXP = /bsd|dragonfly/i.freeze
OS_REGEXP = /bsd|dragonfly/i

DEFAULTS = {
events: [
Expand Down
2 changes: 1 addition & 1 deletion lib/listen/adapter/darwin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Adapter
# Adapter implementation for Mac OS X `FSEvents`.
#
class Darwin < Base
OS_REGEXP = /darwin(?<major_version>(1|2)\d+)/i.freeze
OS_REGEXP = /darwin(?<major_version>(1|2)\d+)/i

# The default delay between checking for changes.
DEFAULTS = { latency: 0.1 }.freeze
Expand Down
4 changes: 2 additions & 2 deletions lib/listen/adapter/linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Listen
module Adapter
# @see https://github.com/nex3/rb-inotify
class Linux < Base
OS_REGEXP = /linux/i.freeze
OS_REGEXP = /linux/i

DEFAULTS = {
events: [
Expand Down Expand Up @@ -60,7 +60,7 @@ def _process_event(dir, event)

cookie_params = event.cookie.zero? ? {} : { cookie: event.cookie }

# Note: don't pass options to force rescanning the directory, so we can
# NOTE: don't pass options to force rescanning the directory, so we can
# detect moving/deleting a whole tree
if _dir_event?(event)
_queue_change(:dir, dir, rel_path, cookie_params)
Expand Down
2 changes: 1 addition & 1 deletion lib/listen/adapter/polling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Adapter
# file IO than the other implementations.
#
class Polling < Base
OS_REGEXP = //.freeze # match every OS
OS_REGEXP = // # match every OS

DEFAULTS = { latency: 1.0, wait_for_delay: 0.05 }.freeze

Expand Down
2 changes: 1 addition & 1 deletion lib/listen/adapter/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Adapter
# Adapter implementation for Windows `wdm`.
#
class Windows < Base
OS_REGEXP = /mswin|mingw|cygwin/i.freeze
OS_REGEXP = /mswin|mingw|cygwin/i

BUNDLER_DECLARE_GEM = <<-EOS.gsub(/^ {6}/, '')
Please add the following to your Gemfile to avoid polling for changes:
Expand Down
2 changes: 2 additions & 0 deletions lib/listen/event/processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ def _deadline

# blocks until event is popped
# returns the event or `nil` when the event_queue is closed
# rubocop:disable Naming/MemoizedInstanceVariableName
def _wait_until_events
config.event_queue.pop.tap do |_event|
@_remember_time_of_first_unprocessed_event ||= MonotonicTime.now
end
end
# rubocop:enable Naming/MemoizedInstanceVariableName

def _flush_wakeup_reasons
until @reasons.empty?
Expand Down
2 changes: 1 addition & 1 deletion lib/listen/fsm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def state(state_name, to: nil, &block)
end
end

# Note: including classes must call initialize_fsm from their initialize method.
# NOTE: including classes must call initialize_fsm from their initialize method.
def initialize_fsm
@fsm_initialized = true
@state = self.class.start_state
Expand Down
2 changes: 0 additions & 2 deletions lib/listen/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def initialize(opts, defaults)
given_options.empty? or raise ArgumentError, "Unknown options: #{given_options.inspect}"
end

# rubocop:disable Lint/MissingSuper
def respond_to_missing?(name, *_)
@options.has_key?(name)
end
Expand All @@ -21,6 +20,5 @@ def method_missing(name, *_)
respond_to_missing?(name) or raise NameError, "Bad option: #{name.inspect} (valid:#{@options.keys.inspect})"
@options[name]
end
# rubocop:enable Lint/MissingSuper
end
end
2 changes: 1 addition & 1 deletion lib/listen/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def build
private

def empty_dirname?(dirname)
dirname == '.' || dirname == ''
['.', ''].include?(dirname)
end

def reset_tree
Expand Down
2 changes: 1 addition & 1 deletion lib/listen/record/symlink_detector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Record
class SymlinkDetector
README_URL = 'https://github.com/guard/listen/blob/master/README.md'

SYMLINK_LOOP_ERROR = <<-EOS
SYMLINK_LOOP_ERROR = <<-EOS.freeze
** ERROR: directory is already being watched! **
Directory: %s
Expand Down
4 changes: 2 additions & 2 deletions lib/listen/silencer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Silencer
# emacs temp files
| \#.+\#
| \.\#.+
)(/|\z)}x.freeze
)(/|\z)}x

# The default list of files that get ignored.
DEFAULT_IGNORED_EXTENSIONS = %r{(?:
Expand Down Expand Up @@ -59,7 +59,7 @@ class Silencer
| \.DS_Store
| \.tmp
| ~
)\z}x.freeze
)\z}x

# TODO: deprecate these mutators; use attr_reader instead
attr_accessor :only_patterns, :ignore_patterns
Expand Down

0 comments on commit 721f843

Please sign in to comment.