diff --git a/.rubocop.yml b/.rubocop.yml index d038f9299..23dd038d8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -137,6 +137,3 @@ Style/TrailingCommaInHashLiteral: #Allow both ['a', 'b'], %w[a b] and %w(a b) style arrays Style/WordArray: Enabled: false - -Style/RedundantCondition: - Enabled: false diff --git a/modules/dns/dns_api.rb b/modules/dns/dns_api.rb index 426cfbe34..c873ef056 100644 --- a/modules/dns/dns_api.rb +++ b/modules/dns/dns_api.rb @@ -47,11 +47,8 @@ class Api < ::Sinatra::Base delete '/:value/?:type?' do name = params[:value] - if params[:type] - type = params[:type] - else - type = (name =~ /\.(in-addr|ip6)\.arpa$/) ? "PTR" : "A" - end + type = params[:type] + type ||= name.end_with?('.in-addr.arpa', '.ip6.arpa') ? 'PTR' : 'A' begin validate_dns_name!(name, type)