Skip to content

Commit

Permalink
Fixes for rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
beque committed Feb 21, 2024
1 parent 1019b91 commit 732893e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
10 changes: 8 additions & 2 deletions lib/datacollector/filecollector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class Filecollector < Fcollector
private

# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/PerceivedComplexity
# rubocop:disable Metrics/BlockLength

def inspect_folder(device)
directory = device.datacollector_dir
Expand Down Expand Up @@ -47,8 +50,6 @@ def inspect_folder(device)
end
end

# rubocop:enable Metrics/AbcSize

def new_files(monitored_folder_p)
if @sftp
new_files_p = @sftp.dir.glob(monitored_folder_p, '*').reject(
Expand Down Expand Up @@ -105,4 +106,9 @@ def inspect_user_folders(device, directory)
end
end
end

# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/PerceivedComplexity
# rubocop:enable Metrics/BlockLength
end
16 changes: 9 additions & 7 deletions lib/datacollector/foldercollector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def modification_time_diff(device, folder_p)

# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/BlockLength
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/PerceivedComplexity

Expand All @@ -38,7 +39,7 @@ def inspect_folder(device)
else
sleep_time = sleep_seconds(device).to_i
new_folders(device.datacollector_dir).each do |new_folder_p| # rubocop:disable Metrics/BlockLength
if (device.datacollector_number_of_files.blank? || (device.datacollector_number_of_files).to_i.zero?) &&
if (device.datacollector_number_of_files.blank? || device.datacollector_number_of_files.to_i.zero?) &&
modification_time_diff(device, new_folder_p) < 30
sleep sleep_time
end
Expand Down Expand Up @@ -80,11 +81,6 @@ def inspect_folder(device)
end
end

# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/PerceivedComplexity

def list_files
if @sftp
all_files = @sftp.dir.glob(@current_collector.path, '**/*').reject(
Expand All @@ -110,7 +106,7 @@ def inspect_user_folders(device)

if recipient
new_folders(new_folder_p).each do |new_folder|
if (device.datacollector_number_of_files.blank? || (device.datacollector_number_of_files).to_i.zero?) &&
if (device.datacollector_number_of_files.blank? || device.datacollector_number_of_files.to_i.zero?) &&
modification_time_diff(device, new_folder) < 30
sleep sleep_time
end
Expand Down Expand Up @@ -152,4 +148,10 @@ def inspect_user_folders(device)
end
end
end

# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/BlockLength
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/PerceivedComplexity
end

0 comments on commit 732893e

Please sign in to comment.