Skip to content

Commit

Permalink
Fix Rails/FindEach cop
Browse files Browse the repository at this point in the history
  • Loading branch information
archanaserver committed Jan 10, 2024
1 parent 96f1eae commit 90b9920
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ Minitest/EmptyLineBeforeAssertionMethods:

Minitest/AssertPredicate:
Enabled: true

Rails/FindEach:
Enabled: true
4 changes: 2 additions & 2 deletions app/controllers/foreman_salt/state_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def remove_from_environment(states, environment)
end

def clean_orphans
SaltModule.all.each do |state|
SaltModule.all.find_each do |state|
state.destroy if state.salt_environments.empty?
end

SaltEnvironment.all.each do |environment|
SaltEnvironment.all.find_each do |environment|
environment.destroy if environment.salt_modules.empty?
end
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20150220122707_fix_incorrect_report_metrics.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class FixIncorrectReportMetrics < ActiveRecord::Migration[4.2]
def up
Report.all.each do |report|
Report.all.find_each do |report|
next unless report.metrics && report.metrics['time']

metrics = report.metrics.dup
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20150411003302_add_environments_to_modules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def up
end

environments = ForemanSalt::SaltEnvironment.all
ForemanSalt::SaltModule.all.each do |state|
ForemanSalt::SaltModule.all.find_each do |state|
state.salt_environments << environments
end
end
Expand Down

0 comments on commit 90b9920

Please sign in to comment.