Skip to content

Commit 55755bf

Browse files
Fix some RuboCop rules (#185)
* Fix Style/SafeNavigation cop * Fix Rails/FindEach cop
1 parent 1cd6b99 commit 55755bf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/services/foreman_templates/parse_result.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def to_h(verbose = false)
1515
:imported => @imported,
1616
:additional_errors => @additional_errors,
1717
:additional_info => @additional_info,
18-
:exception => @exception ? @exception.message : nil,
18+
:exception => @exception&.message,
1919
:validation_errors => errors.to_h,
2020
:file => @template_file,
2121
:type => @template.present? ? @template.class.name.underscore : nil
@@ -27,7 +27,7 @@ def to_h(verbose = false)
2727
end
2828

2929
def errors
30-
@template ? @template.errors : nil
30+
@template&.errors
3131
end
3232

3333
def corrupted_metadata

app/services/foreman_templates/template_importer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def auto_prefix(name)
164164

165165
def purge!
166166
clause = "name #{@negate ? 'NOT ' : ''}LIKE ?"
167-
ProvisioningTemplate.where(clause, "#{@prefix}%").each do |template|
167+
ProvisioningTemplate.where(clause, "#{@prefix}%").find_each do |template|
168168
puts template if @verbose
169169
template.destroy
170170
end

0 commit comments

Comments
 (0)