rubocop and combine remove condition

Stephen Paul Weber created

Change summary

lib/addresses.rb |  5 +++--
lib/oob.rb       |  2 +-
sgx_endstream.rb | 27 +++++++++++++++------------
3 files changed, 19 insertions(+), 15 deletions(-)

Detailed changes

lib/addresses.rb 🔗

@@ -2,10 +2,11 @@
 
 class Addresses < Blather::XMPPNode
 	include Enumerable
+
 	register :addresses, "http://jabber.org/protocol/address"
 
 	def self.new(addresses)
-		new_node = super :addresses
+		new_node = super(:addresses)
 
 		if addresses.is_a?(Array)
 			addresses.each do |address|
@@ -38,7 +39,7 @@ class Addresses < Blather::XMPPNode
 		register :address, "http://jabber.org/protocol/address"
 
 		def self.new(*, type: nil, jid: nil, uri: nil, delivered: nil)
-			new_node = super :address
+			new_node = super(:address)
 			new_node["type"] = type
 			new_node["jid"] = jid if jid
 			new_node["uri"] = uri if uri

lib/oob.rb 🔗

@@ -6,7 +6,7 @@ class OOB < Blather::XMPPNode
 	register :oob, "jabber:x:oob"
 
 	def self.new(url=nil, desc: nil)
-		new_node = super :x
+		new_node = super(:x)
 
 		case url
 		when Nokogiri::XML::Node

sgx_endstream.rb 🔗

@@ -21,6 +21,7 @@ require_relative "lib/registration_repo"
 
 singleton_class.class_eval do
 	include Blather::DSL
+
 	Blather::DSL.append_features(self)
 end
 
@@ -55,7 +56,7 @@ def panic(e, hub=nil)
 		"Error raised during event loop: #{e.class}",
 		e
 	)
-	if e.is_a?(::Exception)
+	if e.is_a?(Exception)
 		(hub || Sentry).capture_exception(e, hint: { background: false })
 	else
 		(hub || Sentry).capture_message(e.to_s, hint: { background: false })
@@ -123,18 +124,20 @@ ibr type: :get do |iq|
 end
 
 ibr type: :set do |iq|
-	if !iq.remove? || iq.phone.to_s !~ /\A\+?1\d{10}\Z/
-		self << iq.as_error("bad-request", :modify, "Invalid phone number")
-		next
-	end
+	unless iq.remove?
+		if iq.phone.to_s !~ /\A\+?1\d{10}\Z/
+			self << iq.as_error("bad-request", :modify, "Invalid phone number")
+			next
+		end
 
-	if (iq.username.to_s.empty? || iq.password.to_s.empty?) && !iq.remove?
-		self << iq.as_error(
-			"bad-request",
-			:modify,
-			"Username and password are required"
-		)
-		next
+		if iq.username.to_s.empty? || iq.password.to_s.empty?
+			self << iq.as_error(
+				"bad-request",
+				:modify,
+				"Username and password are required"
+			)
+			next
+		end
 	end
 
 	REGISTRATION_REPO.delete(iq.from).then { |status|