about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-17 22:30:23 -0500
committerGitHub <noreply@github.com>2023-02-18 04:30:23 +0100
commita6f77aa28ae805e89b0a38c468b7193050174df4 (patch)
treec1ce6315964b84abd58f07b7a0e5b033c0b2e972 /app
parente2567df86063b537e4a3ab2afd5c28a54140f720 (diff)
Autofix Rubocop Lint/AmbiguousOperatorPrecedence (#23681)
Diffstat (limited to 'app')
-rw-r--r--app/controllers/concerns/rate_limit_headers.rb2
-rw-r--r--app/lib/rate_limiter.rb2
-rw-r--r--app/models/system_key.rb2
-rw-r--r--app/models/webauthn_credential.rb2
-rw-r--r--app/workers/concerns/exponential_backoff.rb2
5 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/concerns/rate_limit_headers.rb b/app/controllers/concerns/rate_limit_headers.rb
index b8696df73..b21abfb03 100644
--- a/app/controllers/concerns/rate_limit_headers.rb
+++ b/app/controllers/concerns/rate_limit_headers.rb
@@ -67,6 +67,6 @@ module RateLimitHeaders
   end
 
   def reset_period_offset
-    api_throttle_data[:period] - request_time.to_i % api_throttle_data[:period]
+    api_throttle_data[:period] - (request_time.to_i % api_throttle_data[:period])
   end
 end
diff --git a/app/lib/rate_limiter.rb b/app/lib/rate_limiter.rb
index 0e2c9a894..4a0b35b08 100644
--- a/app/lib/rate_limiter.rb
+++ b/app/lib/rate_limiter.rb
@@ -48,7 +48,7 @@ class RateLimiter
     {
       'X-RateLimit-Limit' => @limit.to_s,
       'X-RateLimit-Remaining' => (@limit - (redis.get(key) || 0).to_i).to_s,
-      'X-RateLimit-Reset' => (now + (@period - now.to_i % @period)).iso8601(6),
+      'X-RateLimit-Reset' => (now + (@period - (now.to_i % @period))).iso8601(6),
     }
   end
 
diff --git a/app/models/system_key.rb b/app/models/system_key.rb
index f17db7c2d..1be399dd6 100644
--- a/app/models/system_key.rb
+++ b/app/models/system_key.rb
@@ -14,7 +14,7 @@ class SystemKey < ApplicationRecord
 
   before_validation :set_key
 
-  scope :expired, ->(now = Time.now.utc) { where(arel_table[:created_at].lt(now - ROTATION_PERIOD * 3)) }
+  scope :expired, ->(now = Time.now.utc) { where(arel_table[:created_at].lt(now - (ROTATION_PERIOD * 3))) }
 
   class << self
     def current_key
diff --git a/app/models/webauthn_credential.rb b/app/models/webauthn_credential.rb
index 7d423e38d..48abfc1d4 100644
--- a/app/models/webauthn_credential.rb
+++ b/app/models/webauthn_credential.rb
@@ -18,5 +18,5 @@ class WebauthnCredential < ApplicationRecord
   validates :external_id, uniqueness: true
   validates :nickname, uniqueness: { scope: :user_id }
   validates :sign_count,
-            numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 2**63 - 1 }
+            numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: (2**63) - 1 }
 end
diff --git a/app/workers/concerns/exponential_backoff.rb b/app/workers/concerns/exponential_backoff.rb
index f2b931e33..7626b2151 100644
--- a/app/workers/concerns/exponential_backoff.rb
+++ b/app/workers/concerns/exponential_backoff.rb
@@ -5,7 +5,7 @@ module ExponentialBackoff
 
   included do
     sidekiq_retry_in do |count|
-      15 + 10 * (count**4) + rand(10 * (count**4))
+      15 + (10 * (count**4)) + rand(10 * (count**4))
     end
   end
 end