Browse Source

But wait, there's more!

Maarten van den Berg 6 years ago
parent
commit
90e1733ae2
4 changed files with 97 additions and 6 deletions
  1. 2 0
      .rubocop.yml
  2. 89 0
      .rubocop_todo.yml
  3. 5 5
      app/models/activity.rb
  4. 1 1
      app/models/person.rb

+ 2 - 0
.rubocop.yml

@@ -1,3 +1,5 @@
1
+inherit_from: .rubocop_todo.yml
2
+
1 3
 # This configuration was generated by
2 4
 # `rubocop --auto-gen-config`
3 5
 # on 2018-12-24 11:44:14 +0100 using RuboCop version 0.60.0.

+ 89 - 0
.rubocop_todo.yml

@@ -0,0 +1,89 @@
1
+# This configuration was generated by
2
+# `rubocop --auto-gen-config`
3
+# on 2018-12-24 21:00:37 +0100 using RuboCop version 0.60.0.
4
+# The point is for the user to remove these configuration records
5
+# one by one as the offenses are removed from the code base.
6
+# Note that changes in the inspected code, or installation of new
7
+# versions of RuboCop, may require this file to be generated again.
8
+
9
+# Offense count: 2
10
+# Cop supports --auto-correct.
11
+Rails/ActiveRecordAliases:
12
+  Exclude:
13
+    - 'app/controllers/activities_controller.rb'
14
+    - 'app/controllers/api/activities_controller.rb'
15
+
16
+# Offense count: 1
17
+# Configuration parameters: Include.
18
+# Include: db/migrate/*.rb
19
+Rails/CreateTableWithTimestamps:
20
+  Exclude:
21
+    - 'db/migrate/20170210180426_remove_tokens_from_users.rb'
22
+
23
+# Offense count: 7
24
+# Configuration parameters: EnforcedStyle.
25
+# SupportedStyles: strict, flexible
26
+Rails/Date:
27
+  Exclude:
28
+    - 'app/controllers/groups_controller.rb'
29
+    - 'app/helpers/authentication_helper.rb'
30
+    - 'app/models/person.rb'
31
+    - 'db/seeds.rb'
32
+
33
+# Offense count: 1
34
+# Configuration parameters: EnforcedStyle.
35
+# SupportedStyles: slashes, arguments
36
+Rails/FilePath:
37
+  Exclude:
38
+    - 'config/environments/development.rb'
39
+
40
+# Offense count: 1
41
+# Configuration parameters: Include.
42
+# Include: app/models/**/*.rb
43
+Rails/HasManyOrHasOneDependent:
44
+  Exclude:
45
+    - 'app/models/person.rb'
46
+
47
+# Offense count: 1
48
+# Cop supports --auto-correct.
49
+# Configuration parameters: EnforcedStyle.
50
+# SupportedStyles: numeric, symbolic
51
+Rails/HttpStatus:
52
+  Exclude:
53
+    - 'app/controllers/application_controller.rb'
54
+
55
+# Offense count: 6
56
+# Cop supports --auto-correct.
57
+Rails/PluralizationGrammar:
58
+  Exclude:
59
+    - 'app/helpers/authentication_helper.rb'
60
+    - 'app/models/person.rb'
61
+    - 'app/models/token.rb'
62
+    - 'db/seeds.rb'
63
+
64
+# Offense count: 1
65
+# Configuration parameters: Include.
66
+# Include: db/migrate/*.rb
67
+Rails/ReversibleMigration:
68
+  Exclude:
69
+    - 'db/migrate/20161214112504_remove_group_type_from_groups.rb'
70
+
71
+# Offense count: 4
72
+# Configuration parameters: Blacklist, Whitelist.
73
+# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
74
+Rails/SkipsModelValidations:
75
+  Exclude:
76
+    - 'app/controllers/members_controller.rb'
77
+    - 'app/models/activity.rb'
78
+    - 'app/models/user.rb'
79
+
80
+# Offense count: 9
81
+# Configuration parameters: EnforcedStyle.
82
+# SupportedStyles: strict, flexible
83
+Rails/TimeZone:
84
+  Exclude:
85
+    - 'app/controllers/activities_controller.rb'
86
+    - 'app/controllers/api/groups_controller.rb'
87
+    - 'app/controllers/dashboard_controller.rb'
88
+    - 'app/models/group.rb'
89
+    - 'db/seeds.rb'

+ 5 - 5
app/models/activity.rb

@@ -178,27 +178,27 @@ class Activity < ApplicationRecord
178 178
       st            = Time.strptime(row['start_time'], '%H:%M')
179 179
       a.start       = Time.zone.local(sd.year, sd.month, sd.day, st.hour, st.min)
180 180
 
181
-      unless row['end_date'].blank?
181
+      if row['end_date'].present?
182 182
         ed          = Date.strptime(row['end_date'])
183 183
         et          = Time.strptime(row['end_time'], '%H:%M')
184 184
         a.end       = Time.zone.local(ed.year, ed.month, ed.day, et.hour, et.min)
185 185
       end
186 186
 
187
-      unless row['deadline_date'].blank?
187
+      if row['deadline_date'].present?
188 188
         dd            = Date.strptime(row['deadline_date'])
189 189
         dt            = Time.strptime(row['deadline_time'], '%H:%M')
190 190
         a.deadline    = Time.zone.local(dd.year, dd.month, dd.day, dt.hour, dt.min)
191 191
       end
192 192
 
193
-      unless row['reminder_at_date'].blank?
193
+      if row['reminder_at_date'].present?
194 194
         rd            = Date.strptime(row['reminder_at_date'])
195 195
         rt            = Time.strptime(row['reminder_at_time'], '%H:%M')
196 196
         a.reminder_at = Time.zone.local(rd.year, rd.month, rd.day, rt.hour, rt.min)
197 197
       end
198 198
 
199
-      a.subgroup_division_enabled = row['subgroup_division_enabled'].casecmp('y').zero? unless row['subgroup_division_enabled'].blank?
199
+      a.subgroup_division_enabled = row['subgroup_division_enabled'].casecmp('y').zero? if row['subgroup_division_enabled'].present?
200 200
 
201
-      a.no_response_action = row['no_response_action'].casecmp('p').zero? unless row['no_response_action'].blank?
201
+      a.no_response_action = row['no_response_action'].casecmp('p').zero? if row['no_response_action'].present?
202 202
 
203 203
       result << a
204 204
     end

+ 1 - 1
app/models/person.rb

@@ -88,7 +88,7 @@ class Person < ApplicationRecord
88 88
         p.infix       = row['infix']
89 89
         p.last_name   = row['last_name']
90 90
         p.email       = row['email']
91
-        p.birth_date  = Date.strptime(row['birth_date']) unless row['birth_date'].blank?
91
+        p.birth_date  = Date.strptime(row['birth_date']) if row['birth_date'].present?
92 92
         p.save!
93 93
       end
94 94
       result << p