Browse Source

Freeze constants

Maarten van den Berg 6 years ago
parent
commit
716c713fc5
3 changed files with 3 additions and 10 deletions
  1. 0 7
      .rubocop.yml
  2. 2 2
      app/models/participant.rb
  3. 1 1
      app/models/token.rb

+ 0 - 7
.rubocop.yml

214
   Exclude:
214
   Exclude:
215
     - 'app/models/session.rb'
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
 # Offense count: 1
217
 # Offense count: 1
225
 # Cop supports --auto-correct.
218
 # Cop supports --auto-correct.
226
 # Configuration parameters: Strict.
219
 # Configuration parameters: Strict.

+ 2 - 2
app/models/participant.rb

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

+ 1 - 1
app/models/token.rb

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