Skip to content

Commit

Permalink
Fix some RuboCop rules (#185)
Browse files Browse the repository at this point in the history
* Fix Style/SafeNavigation cop

* Fix Rails/FindEach cop
  • Loading branch information
archanaserver authored Jul 10, 2024
1 parent 1cd6b99 commit 55755bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/services/foreman_templates/parse_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def to_h(verbose = false)
:imported => @imported,
:additional_errors => @additional_errors,
:additional_info => @additional_info,
:exception => @exception ? @exception.message : nil,
:exception => @exception&.message,
:validation_errors => errors.to_h,
:file => @template_file,
:type => @template.present? ? @template.class.name.underscore : nil
Expand All @@ -27,7 +27,7 @@ def to_h(verbose = false)
end

def errors
@template ? @template.errors : nil
@template&.errors
end

def corrupted_metadata
Expand Down
2 changes: 1 addition & 1 deletion app/services/foreman_templates/template_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def auto_prefix(name)

def purge!
clause = "name #{@negate ? 'NOT ' : ''}LIKE ?"
ProvisioningTemplate.where(clause, "#{@prefix}%").each do |template|
ProvisioningTemplate.where(clause, "#{@prefix}%").find_each do |template|
puts template if @verbose
template.destroy
end
Expand Down

0 comments on commit 55755bf

Please sign in to comment.