guard / listen

The Listen gem listens to file modifications and notifies you about the changes.
https://rubygems.org/gems/listen
MIT License
1.92k stars 245 forks source link

Issue #504: try merging invoca .rubocop.yml #508

Closed ColinDKelley closed 3 years ago

ColinDKelley commented 3 years ago

I made an attempt to address issue #504 :

After the above tuning and auto-correcting, there were 15 remaining offenses: ``` lib/listen/event/processor.rb:73:9: C: Naming/MemoizedInstanceVariableName: Memoized variable @first_unprocessed_event_time does not match method name _remember_time_of_first_unprocessed_event. Use @_remember_time_of_first_unprocessed_event instead. @first_unprocessed_event_time ||= _timestamp ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/listen/options.rb:19:5: C: Style/MissingRespondToMissing: When using method_missing, define respond_to_missing?. def method_missing(name, *_) ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/listen/thread.rb:18:9: W: Lint/RescueException: Avoid rescuing the Exception class. Perhaps you meant to rescue StandardError? rescue Exception => ex ... ^^^^^^^^^^^^^^^^^^^^^^ lib/listen/thread.rb:21:9: C: Style/MultilineBlockChain: Avoid multi-line chains of blocks. end.tap do |thread| ^^^^^^^ lib/listen/thread.rb:28:26: C: Naming/MethodParameterName: Method parameter must be at least 3 characters long. def _log_exception(ex, thread_name, caller_stack) ^^ lib/listen/thread.rb:34:34: C: Naming/MethodParameterName: Method parameter must be at least 3 characters long. def _exception_with_causes(ex) ^^ listen.gemspec:30:31: C: Gemspec/RequiredRubyVersion: required_ruby_version (2.2, declared in listen.gemspec) and TargetRubyVersion (2.6, which may be specified in .rubocop.yml) should be equal. gem.required_ruby_version = '>= 2.2.7' ^^^^^^^^^^ spec/acceptance/listen_spec.rb:20:48: W: Lint/LiteralAsCondition: Literal 'both' appeared as a condition. case ENV['TEST_LISTEN_ADAPTER_MODES'] || 'both' ^^^^^^ spec/lib/listen/directory_spec.rb:16:21: C: Naming/MethodParameterName: Method parameter must be at least 3 characters long. def fake_children(ex, dir, *args, &block) ^^ spec/lib/listen/thread_spec.rb:32:151: C: Layout/LineLength: Line is too long. [177/150] with(/Exception rescued in listen-worker_thread:\nArgumentError: boom!\n.*\/listen\/thread\.rb.*--- Thread.new ---.*\/listen\/thread_spec\.rb/m) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/lib/listen/thread_spec.rb:54:34: C: Layout/DotPosition: Place the . on the previous line, together with the method call receiver. .with(/RuntimeError: nested outer\n--- Caused by: ---\nRuntimeError: nested inner\n--- Caused by: ---\nArgumentError: boom!/) ^ spec/lib/listen/thread_spec.rb:54:151: C: Layout/LineLength: Line is too long. [158/150] .with(/RuntimeError: nested outer\n--- Caused by: ---\nRuntimeError: nested inner\n--- Caused by: ---\nArgumentError: boom!/) ^^^^^^^^ spec/support/acceptance_helper.rb:46:5: C: Security/Open: The use of Kernel#open is a serious security risk. open(path, 'a') { |f| f.write('foo') } ^^^^ spec/support/acceptance_helper.rb:59:5: C: Security/Open: The use of Kernel#open is a serious security risk. open(path, 'w') { |f| f.write('foo') } ^^^^ spec/support/acceptance_helper.rb:181:3: W: Lint/DuplicateMethods: Method ListenerWrapper#changes is defined at both spec/support/acceptance_helper.rb:146 and spec/support/acceptance_helper.rb:181. def changes ^^^^^^^^^^^ ```
After fixing the easy ones, there are 5 offenses left: ``` lib/listen/options.rb:19:5: C: Style/MissingRespondToMissing: When using method_missing, define respond_to_missing?. def method_missing(name, *_) ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/listen/thread.rb:18:9: W: Lint/RescueException: Avoid rescuing the Exception class. Perhaps you meant to rescue StandardError? rescue Exception => exception ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ listen.gemspec:30:31: C: Gemspec/RequiredRubyVersion: required_ruby_version (2.2, declared in listen.gemspec) and TargetRubyVersion (2.6, which may be specified in .rubocop.yml) should be equal. gem.required_ruby_version = '>= 2.2.7' ^^^^^^^^^^ spec/support/acceptance_helper.rb:46:5: C: Security/Open: The use of Kernel#open is a serious security risk. open(path, 'a') { |f| f.write('foo') } ^^^^ spec/support/acceptance_helper.rb:59:5: C: Security/Open: The use of Kernel#open is a serious security risk. open(path, 'w') { |f| f.write('foo') } ^^^^ 65 files inspected, 5 offenses detected ```
ColinDKelley commented 3 years ago

@KapilSachdev What do you think?

ColinDKelley commented 3 years ago

@KapilSachdev I merged up to latest master and applied all the changes in discussion here.

$ rubocop
Inspecting 65 files
.................................................................

65 files inspected, no offenses detected