Skip to content

Commit

Permalink
chore: Fix brakeman warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mromulus committed Dec 5, 2023
1 parent eb3db5d commit ddd16e8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/calculation/clone_environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def clone_customization_specs(current_specs:, vm_id:)

if combined_data[:capabilities].any?
ActiveRecord::Base.connection.execute <<-SQL
INSERT INTO capabilities_customization_specs (#{combined_data[:capabilities].first.keys.join(",")}) VALUES
#{combined_data[:capabilities].map(&:values).map { |values| "(#{values.join(",")})" }.join(", ")}
INSERT INTO capabilities_customization_specs (#{ActiveRecord::Base.connection.quote(combined_data[:capabilities].first.keys.join(","))}) VALUES
#{ActiveRecord::Base.connection.quote(combined_data[:capabilities].map(&:values).map { |values| "(#{values.join(",")})" }.join(", "))}
SQL
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def relation_to_api_name(relation)
def relation_to_icon(relation)
case relation
when CustomCheckSubject
relation.base_class.constantize.to_icon
relation.safe_class.to_icon
when Network, CustomizationSpec
relation.class.to_icon
end
Expand Down
6 changes: 6 additions & 0 deletions app/models/custom_check_subject.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ def api_name
def type_for_api
'custom'
end

def safe_class
if %w(CustomizationSpec Network).include?(base_class)
base_class.to_s.constantize
end
end
end

0 comments on commit ddd16e8

Please sign in to comment.