Browse Source

Block Delimiters, BracesAroundHashParameters

Maarten van den Berg 6 years ago
parent
commit
76093fceef

+ 0 - 23
.rubocop.yml

@@ -45,29 +45,6 @@ Metrics/ModuleLength:
45 45
 Metrics/PerceivedComplexity:
46 46
   Max: 13
47 47
 
48
-# Offense count: 9
49
-# Cop supports --auto-correct.
50
-# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods.
51
-# SupportedStyles: line_count_based, semantic, braces_for_chaining
52
-# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
53
-# FunctionalMethods: let, let!, subject, watch
54
-# IgnoredMethods: lambda, proc, it
55
-Style/BlockDelimiters:
56
-  Exclude:
57
-    - 'app/controllers/activities_controller.rb'
58
-    - 'app/controllers/groups_controller.rb'
59
-    - 'app/controllers/members_controller.rb'
60
-
61
-# Offense count: 3
62
-# Cop supports --auto-correct.
63
-# Configuration parameters: EnforcedStyle.
64
-# SupportedStyles: braces, no_braces, context_dependent
65
-Style/BracesAroundHashParameters:
66
-  Exclude:
67
-    - 'app/models/activity.rb'
68
-    - 'app/models/person.rb'
69
-    - 'config/environments/production.rb'
70
-
71 48
 # Offense count: 2
72 49
 # Cop supports --auto-correct.
73 50
 Style/ClassMethods:

+ 6 - 6
app/controllers/activities_controller.rb

@@ -171,10 +171,10 @@ class ActivitiesController < ApplicationController
171 171
 
172 172
     respond_to do |format|
173 173
       if @activity.save
174
-        format.html {
174
+        format.html do
175 175
           redirect_to group_activity_url(@group, @activity)
176 176
           flash_message(:info, I18n.t('activities.created'))
177
-        }
177
+        end
178 178
         format.json { render :show, status: :created, location: @activity }
179 179
       else
180 180
         format.html { render :new }
@@ -205,10 +205,10 @@ class ActivitiesController < ApplicationController
205 205
   def update
206 206
     respond_to do |format|
207 207
       if @activity.update(activity_params)
208
-        format.html {
208
+        format.html do
209 209
           redirect_to group_activity_url(@group, @activity)
210 210
           flash_message(:info, I18n.t('activities.updated'))
211
-        }
211
+        end
212 212
         format.json { render :show, status: :ok, location: @activity }
213 213
       else
214 214
         set_edit_parameters!
@@ -223,10 +223,10 @@ class ActivitiesController < ApplicationController
223 223
   def destroy
224 224
     @activity.destroy
225 225
     respond_to do |format|
226
-      format.html {
226
+      format.html do
227 227
         redirect_to group_activities_url(@group)
228 228
         flash_message(:info, 'Activity was successfully destroyed.')
229
-      }
229
+      end
230 230
       format.json { head :no_content }
231 231
     end
232 232
   end

+ 6 - 6
app/controllers/groups_controller.rb

@@ -60,10 +60,10 @@ class GroupsController < ApplicationController
60 60
 
61 61
     respond_to do |format|
62 62
       if @group.save
63
-        format.html {
63
+        format.html do
64 64
           redirect_to @group
65 65
           flash_message(:info, I18n.t('groups.created'))
66
-        }
66
+        end
67 67
         format.json { render :show, status: :created, location: @group }
68 68
       else
69 69
         format.html { render :new }
@@ -77,10 +77,10 @@ class GroupsController < ApplicationController
77 77
   def update
78 78
     respond_to do |format|
79 79
       if @group.update(group_params)
80
-        format.html {
80
+        format.html do
81 81
           redirect_to @group
82 82
           flash_message(:info, I18n.t('groups.updated'))
83
-        }
83
+        end
84 84
         format.json { render :show, status: :ok, location: @group }
85 85
       else
86 86
         @defaultsubgroup = DefaultSubgroup.new
@@ -95,10 +95,10 @@ class GroupsController < ApplicationController
95 95
   def destroy
96 96
     @group.destroy
97 97
     respond_to do |format|
98
-      format.html {
98
+      format.html do
99 99
         redirect_to groups_url
100 100
         flash_message(:info, I18n.t('groups.destroyed'))
101
-      }
101
+      end
102 102
       format.json { head :no_content }
103 103
     end
104 104
   end

+ 6 - 6
app/controllers/members_controller.rb

@@ -87,10 +87,10 @@ class MembersController < ApplicationController
87 87
 
88 88
     respond_to do |format|
89 89
       if @member.save
90
-        format.html {
90
+        format.html do
91 91
           redirect_to group_member_url(@group, @member)
92 92
           flash_message(:info, I18n.t('groups.member_added', name: @member.person.full_name))
93
-        }
93
+        end
94 94
         format.json { render :show, status: :created, location: @member }
95 95
       else
96 96
         @possible_members = Person.where.not(id: @group.person_ids)
@@ -105,10 +105,10 @@ class MembersController < ApplicationController
105 105
   def update
106 106
     respond_to do |format|
107 107
       if @member.update(member_params)
108
-        format.html {
108
+        format.html do
109 109
           redirect_to group_member_url(@group, @member)
110 110
           flash_message(:info, I18n.t('groups.member_updated'))
111
-        }
111
+        end
112 112
         format.json { render :show, status: :ok, location: @member }
113 113
       else
114 114
         @possible_members = Person.where.not(id: @group.person_ids)
@@ -123,10 +123,10 @@ class MembersController < ApplicationController
123 123
   def destroy
124 124
     @member.destroy
125 125
     respond_to do |format|
126
-      format.html {
126
+      format.html do
127 127
         redirect_to group_members_url(@group)
128 128
         flash_message(:info, I18n.t('groups.member_removed', name: @member.person.full_name))
129
-      }
129
+      end
130 130
       format.json { head :no_content }
131 131
     end
132 132
   end

+ 1 - 1
app/models/activity.rb

@@ -164,7 +164,7 @@ class Activity < ApplicationRecord
164 164
 
165 165
   # Create multiple Activities from data in a CSV file, assign to a group, return.
166 166
   def self.from_csv(content, group)
167
-    reader = CSV.parse(content, { headers: true, skip_blanks: true })
167
+    reader = CSV.parse(content, headers: true, skip_blanks: true)
168 168
 
169 169
     result = []
170 170
     reader.each do |row|

+ 1 - 1
app/models/person.rb

@@ -77,7 +77,7 @@ class Person < ApplicationRecord
77 77
 
78 78
   # Create multiple Persons from data found in a csv file, return those.
79 79
   def self.from_csv(content)
80
-    reader = CSV.parse(content, { headers: true, skip_blanks: true })
80
+    reader = CSV.parse(content, headers: true, skip_blanks: true)
81 81
 
82 82
     result = []
83 83
     reader.each do |row|

+ 1 - 1
config/environments/production.rb

@@ -19,7 +19,7 @@ Rails.application.configure do
19 19
   config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
20 20
 
21 21
   # Compress JavaScripts and CSS.
22
-  config.assets.js_compressor = Uglifier.new({ harmony: true })
22
+  config.assets.js_compressor = Uglifier.new(harmony: true)
23 23
   # config.assets.css_compressor = :sass
24 24
 
25 25
   # Do not fallback to assets pipeline if a precompiled asset is missed.