Class: Packs::RubocopPostProcessor
- Inherits:
-
Object
- Object
- Packs::RubocopPostProcessor
- Extended by:
- T::Sig
- Includes:
- PerFileProcessorInterface
- Defined in:
- lib/packs/rubocop_post_processor.rb
Instance Method Summary collapse
Methods included from PerFileProcessorInterface
Instance Method Details
#before_move_file!(file_move_operation) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/packs/rubocop_post_processor.rb', line 9 def before_move_file!(file_move_operation) return unless rubocop_enabled? relative_path_to_origin = file_move_operation.origin_pathname relative_path_to_destination = file_move_operation.destination_pathname rubocop_todo = Pathname.new('.rubocop_todo.yml') if rubocop_todo.exist? Packs.replace_in_file( file: rubocop_todo.to_s, find: relative_path_to_origin, replace_with: relative_path_to_destination ) end end |
#rubocop_enabled? ⇒ Boolean
26 27 28 |
# File 'lib/packs/rubocop_post_processor.rb', line 26 def rubocop_enabled? Pathname.new('.rubocop.yml').exist? end |