Kaynağa Gözat

Freeze constants

Maarten van den Berg 6 yıl önce
ebeveyn
işleme
716c713fc5
3 değiştirilmiş dosya ile 3 ekleme ve 10 silme
  1. 0 7
      .rubocop.yml
  2. 2 2
      app/models/participant.rb
  3. 1 1
      app/models/token.rb

+ 0 - 7
.rubocop.yml

@@ -214,13 +214,6 @@ Style/MultilineTernaryOperator:
214 214
   Exclude:
215 215
     - 'app/models/session.rb'
216 216
 
217
-# Offense count: 3
218
-# Cop supports --auto-correct.
219
-Style/MutableConstant:
220
-  Exclude:
221
-    - 'app/models/participant.rb'
222
-    - 'app/models/token.rb'
223
-
224 217
 # Offense count: 1
225 218
 # Cop supports --auto-correct.
226 219
 # Configuration parameters: Strict.

+ 2 - 2
app/models/participant.rb

@@ -31,7 +31,7 @@ class Participant < ApplicationRecord
31 31
     true => I18n.t('activities.state.present'),
32 32
     false => I18n.t('activities.state.absent'),
33 33
     nil => I18n.t('activities.state.unknown')
34
-  }
34
+  }.freeze
35 35
 
36 36
   # @return [String]
37 37
   #   the name for the Participant's current state in the current locale.
@@ -43,7 +43,7 @@ class Participant < ApplicationRecord
43 43
     true => 'ATTENDING',
44 44
     false => 'CANCELLED',
45 45
     nil => 'TENTATIVE'
46
-  }
46
+  }.freeze
47 47
 
48 48
   # @return [String]
49 49
   #   the ICal attending response.

+ 1 - 1
app/models/token.rb

@@ -30,7 +30,7 @@ class Token < ApplicationRecord
30 30
     password_reset: 'pw_reset',
31 31
     account_confirmation: 'confirm',
32 32
     api_authentication: 'api'
33
-  }
33
+  }.freeze
34 34
 
35 35
   validates :token, uniqueness: true, presence: true
36 36
   validates :user, presence: true