Skip to content

Commit 20a39be

Browse files
moozzidutow
authored andcommitted
[rubocop] Fix all rubocop offenses
1 parent efe9697 commit 20a39be

123 files changed

Lines changed: 821 additions & 833 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/controllers/activities_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def index
77
@search_query = params[:q].to_s.strip
88
@activities = base_scope
99
.then { |scope| apply_query(scope) }
10-
.includes(subject: [:topic, { message: :sender }])
10+
.includes(subject: [ :topic, { message: :sender } ])
1111
.order(created_at: :desc)
1212
.limit(100)
1313
mark_shown_as_read!(@activities)

app/controllers/admin/base_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
class Admin::BaseController < ApplicationController
4-
layout 'admin'
4+
layout "admin"
55

66
before_action :require_admin
77

app/controllers/admin/imap_sync_states_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ def index
2121
end
2222
end
2323
end
24-

app/controllers/admin/users_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# frozen_string_literal: true
22

33
class Admin::UsersController < Admin::BaseController
4-
before_action :set_user, only: [:toggle_admin, :new_email, :confirm_email, :add_email]
4+
before_action :set_user, only: [ :toggle_admin, :new_email, :confirm_email, :add_email ]
55

66
def active_admin_section
77
:users
88
end
99

1010
def index
1111
@users = User.active
12-
.includes(person: [:default_alias, :aliases])
12+
.includes(person: [ :default_alias, :aliases ])
1313
.order(created_at: :desc)
1414
.limit(params.fetch(:limit, 50).to_i)
1515
.offset(params.fetch(:offset, 0).to_i)
@@ -34,7 +34,7 @@ def confirm_email
3434
end
3535

3636
@existing_aliases = Alias.by_email(@email)
37-
@owned_by_other = @existing_aliases.where.not(user_id: [nil, @user.id]).exists?
37+
@owned_by_other = @existing_aliases.where.not(user_id: [ nil, @user.id ]).exists?
3838
end
3939

4040
def add_email
@@ -48,7 +48,7 @@ def add_email
4848

4949
aliases = Alias.by_email(email)
5050

51-
if aliases.where.not(user_id: [nil, @user.id]).exists?
51+
if aliases.where.not(user_id: [ nil, @user.id ]).exists?
5252
return redirect_to admin_users_path, alert: "Email is linked to another account. Cannot associate."
5353
end
5454

app/controllers/application_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ class ApplicationController < ActionController::Base
88
before_action :authorize_mini_profiler
99

1010
private
11-
11+
1212
def render_404
13-
render file: Rails.root.join('public', '404.html'), status: :not_found, layout: false
13+
render file: Rails.root.join("public", "404.html"), status: :not_found, layout: false
1414
end
1515

1616
def current_user
@@ -28,7 +28,7 @@ def current_admin?
2828
end
2929

3030
def require_authentication
31-
redirect_to new_session_path, alert: 'Please sign in' unless user_signed_in?
31+
redirect_to new_session_path, alert: "Please sign in" unless user_signed_in?
3232
end
3333

3434
def authorize_mini_profiler

app/controllers/attachments_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ def show
1010
send_data data, filename: filename, type: content_type, disposition: "attachment"
1111
end
1212
end
13-

app/controllers/concerns/profile_activity.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def compute_activity_types(message:, topic:, first_message_per_topic:, first_pat
177177

178178
def build_contribution_weeks(year, filters: nil)
179179
ids = person_ids_for_query
180-
return [[], []] if ids.blank?
180+
return [ [], [] ] if ids.blank?
181181

182182
year = year.to_i
183183
wday_start = @week_start_day || WeekCalculation::DEFAULT_WEEK_START
@@ -208,7 +208,7 @@ def build_contribution_weeks(year, filters: nil)
208208
end
209209

210210
month_spans = build_month_spans(weeks_data)
211-
[weeks_data, month_spans]
211+
[ weeks_data, month_spans ]
212212
end
213213

214214
def build_month_spans(weeks_data)
@@ -218,10 +218,10 @@ def build_month_spans(weeks_data)
218218

219219
weeks_data.each do |week|
220220
first_date = week[:days].first[:date]
221-
month_key = [first_date.year, first_date.month]
221+
month_key = [ first_date.year, first_date.month ]
222222
if current_month != month_key
223223
if current_month
224-
month_spans << { label: Date.new(current_month[0], current_month[1], 1).strftime('%b'), year: current_month[0], month: current_month[1], span: current_span }
224+
month_spans << { label: Date.new(current_month[0], current_month[1], 1).strftime("%b"), year: current_month[0], month: current_month[1], span: current_span }
225225
end
226226
current_month = month_key
227227
current_span = 1
@@ -230,7 +230,7 @@ def build_month_spans(weeks_data)
230230
end
231231
end
232232

233-
month_spans << { label: Date.new(current_month[0], current_month[1], 1).strftime('%b'), year: current_month[0], month: current_month[1], span: current_span } if current_month
233+
month_spans << { label: Date.new(current_month[0], current_month[1], 1).strftime("%b"), year: current_month[0], month: current_month[1], span: current_span } if current_month
234234
month_spans
235235
end
236236

app/controllers/help_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class HelpController < ApplicationController
66
PAGES = {
77
"search" => "Advanced Search Guide",
88
"hackorum-patch" => "Applying Patches with hackorum-patch",
9-
"account-linking" => "Account Linking & Multiple Emails",
9+
"account-linking" => "Account Linking & Multiple Emails"
1010
}.freeze
1111

1212
def index

app/controllers/messages_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# frozen_string_literal: true
22

33
class MessagesController < ApplicationController
4-
before_action :require_authentication, only: [:read]
4+
before_action :require_authentication, only: [ :read ]
55

66
def by_message_id
77
raw = params[:message_id].to_s
8-
decoded = CGI.unescape(raw.gsub('+', '%2B'))
8+
decoded = CGI.unescape(raw.gsub("+", "%2B"))
99
message = Message.find_by(message_id: decoded)
1010

1111
if message

app/controllers/notes_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class NotesController < ApplicationController
44
before_action :require_authentication
5-
before_action :set_note, only: [:update, :destroy]
5+
before_action :set_note, only: [ :update, :destroy ]
66

77
def create
88
topic = Topic.find(note_params[:topic_id])
@@ -62,7 +62,7 @@ def set_note
6262
end
6363
unless @note.author_id == current_user.id
6464
redirect_back fallback_location: topic_path(@note.topic), alert: "You can edit or delete your own notes"
65-
return
65+
nil
6666
end
6767
end
6868

0 commit comments

Comments
 (0)