Skip to content

Commit

Permalink
Fix Various Lint Cops (Katello#11069)
Browse files Browse the repository at this point in the history
* Fix Lint/DuplicateRequire cop

* Fix Lint/UnreachableLoop cop

* Fix Lint/EmptyFile cop

* Fix Lint/RedundantSafeNavigation cop

* Fix Lint/DeprecatedOpenSSLConstant cop

* Update .rubocop.yml
  • Loading branch information
archanaserver committed Jul 18, 2024
1 parent 01b1c15 commit 287adc6
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,6 @@ Style/GlobalStdStream:

Style/RedundantFileExtensionInRequire:
Enabled: false

Lint/MixedRegexpCaptureTypes:
Enabled: false
2 changes: 1 addition & 1 deletion app/controllers/katello/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def render_bad_parameters(*args)
exception = args.find { |o| o.is_a? Exception }
message = args.find { |o| o.is_a? String } || exception.try(:message) || default_message

status = if exception&.respond_to?(:status_code)
status = if exception.respond_to?(:status_code)
exception.status_code
else
400
Expand Down
2 changes: 2 additions & 0 deletions app/lib/actions/katello/host/hypervisors_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def run
end
end

return if @duplicate_uuid_hypervisors.empty?

@duplicate_uuid_hypervisors.each do |hypervisor, existing_host|
fail _("Host creation was skipped for %s because it shares a BIOS UUID with %s. " \
"To report this hypervisor, override its dmi.system.uuid fact or set 'candlepin.use_system_uuid_for_matching' " \
Expand Down
2 changes: 1 addition & 1 deletion app/models/katello/candlepin/repository_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def prune_substitutions(subs, url)

def feed_url
return if product.organization.cdn_configuration.export_sync?
@feed_url ||= if product.cdn_resource&.respond_to?(:repository_url)
@feed_url ||= if product.cdn_resource.respond_to?(:repository_url)
product.cdn_resource.repository_url(content_label: content.label, arch: arch, major: version[:major], minor: version[:minor])
else
product.repo_url(path)
Expand Down
2 changes: 1 addition & 1 deletion app/views/katello/api/v2/repository_sets/show.json.rabl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ node :enabled_content_override do |pc|
end

node :redhat do |pc|
if pc&.product&.respond_to? :redhat?
if pc&.product.respond_to? :redhat?
pc.product.redhat?
end
end
2 changes: 0 additions & 2 deletions lib/katello.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

require "deface"

require "securerandom"

# to make Foreman#in_rake? helper available if Foreman's lib is available
lib_foreman = File.expand_path('lib/foreman', Rails.root)
require lib_foreman if Dir.exist?(lib_foreman)
Expand Down
2 changes: 1 addition & 1 deletion test/actions/katello/cdn_configuration/update_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def keypair
cert.public_key = key.public_key
cert.not_before = Time.now
cert.not_after = Time.now + 1000
cert.sign key, OpenSSL::Digest::SHA256.new
cert.sign key, OpenSSL::Digest.new('SHA256')

{
cert: cert,
Expand Down
2 changes: 1 addition & 1 deletion test/factories/content_credential_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cert.public_key = key.public_key
cert.not_before = Time.now
cert.not_after = Time.now + 1000
cert.sign key, OpenSSL::Digest::SHA256.new
cert.sign key, OpenSSL::Digest.new('SHA256')
cert.to_pem
end

Expand Down
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion test/services/katello/pxe_files_downloader_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def generate_certificate
cert.add_extension ef.create_extension("authorityKeyIdentifier",
"keyid:always,issuer:always")

cert.sign key, OpenSSL::Digest::SHA1.new
cert.sign key, OpenSSL::Digest.new('SHA1')

cert.to_pem
end
Expand Down

0 comments on commit 287adc6

Please sign in to comment.