Skip to content

Commit 333d845

Browse files
committed
Fix rubocop errors
1 parent 50c2c52 commit 333d845

32 files changed

Lines changed: 120 additions & 86 deletions

.rubocop.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Metrics/BlockLength:
4949
Metrics/ClassLength:
5050
Exclude:
5151
- 'db/seeds.rb'
52-
Max: 150
52+
Max: 180
5353

5454
Metrics/ModuleLength:
5555
Max: 150
@@ -60,6 +60,9 @@ Naming/FileName:
6060
- 'Guardfile'
6161
- 'Rakefile'
6262

63+
Rails/I18nLocaleTexts:
64+
Enabled: false
65+
6366
Style/Documentation:
6467
Enabled: false
6568

app/classes/html_renderer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class HTMLRenderer < Redcarpet::Render::HTML
55
no_styles: true, prettify: true, safe_links_only: true }.freeze
66

77
def initialize(*_)
8-
super OPTIONS.dup
8+
super(OPTIONS.dup)
99
end
1010

1111
def header(text, header_level)

app/controllers/api/v1/webhooks_controller.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def commit_payload?
3838
end
3939

4040
def app_secret
41-
@app_secret ||= ENV['GITHUB_WEBHOOK_SECRET']
41+
@app_secret ||= ENV.fetch('GITHUB_WEBHOOK_SECRET', nil)
4242
end
4343

4444
def request_signature
@@ -90,7 +90,7 @@ def issue_params
9090
issue_type: issue_type,
9191
user: github_user,
9292
summary: issue_payload[:title],
93-
description: (issue_payload[:body].presence || 'Imported') }
93+
description: issue_payload[:body].presence || 'Imported' }
9494
end
9595

9696
def github_user_valid?
@@ -153,14 +153,21 @@ def process_commit(payload)
153153
end
154154
end
155155

156+
def callout_message(callout)
157+
return unless callout&.errors
158+
159+
errors = callout.errors
160+
errors&.messages&.inspect
161+
end
162+
156163
def perform_repo_callout_action(repo_callout)
157164
repo_callout.process_commit_message
158165
return unless repo_callout.save!
159166

160167
repo_callout.perform_action
161168
rescue ActiveRecord::RecordInvalid
162169
logger.info "GitHub commit can't be process. RepoCallout is invalid:"
163-
logger.info repo_callout&.errors&.messages&.inspect
170+
logger.info callout_message(repo_callout)
164171
end
165172

166173
def process_user(payload)

app/controllers/issue_comments_controller.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ class IssueCommentsController < ApplicationController
66
load_and_authorize_resource :issue
77
load_and_authorize_resource through: :issue, through_association: :comments
88

9-
def new
9+
def show
1010
respond_to do |format|
11-
format.html
11+
format.html do
12+
redirect_to issue_path(@issue, anchor: "comment-#{@issue_comment.id}")
13+
end
1214
format.js
1315
end
1416
end
1517

16-
def edit
18+
def new
1719
respond_to do |format|
1820
format.html
1921
format.js
2022
end
2123
end
2224

23-
def show
25+
def edit
2426
respond_to do |format|
25-
format.html do
26-
redirect_to issue_path(@issue, anchor: "comment-#{@issue_comment.id}")
27-
end
27+
format.html
2828
format.js
2929
end
3030
end

app/controllers/issue_subscriptions_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def destroy
2828
private
2929

3030
def create_success
31-
notice = "Subscribed to Issue ##{@issue.id}. You will be notified after "\
32-
'updates.'
31+
notice = "Subscribed to Issue ##{@issue.id}. You will be notified " \
32+
'after updates.'
3333
respond_to do |format|
3434
format.html { redirect_back fallback_location: @issue, notice: notice }
3535
format.js { render :show }

app/controllers/task_comments_controller.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ class TaskCommentsController < ApplicationController
44
load_and_authorize_resource :task
55
load_and_authorize_resource through: :task, through_association: :comments
66

7-
def new
7+
def show
88
respond_to do |format|
9-
format.html
9+
format.html do
10+
redirect_to task_path(@task, anchor: "comment-#{@task_comment.id}")
11+
end
1012
format.js
1113
end
1214
end
1315

14-
def edit
16+
def new
1517
respond_to do |format|
1618
format.html
1719
format.js
1820
end
1921
end
2022

21-
def show
23+
def edit
2224
respond_to do |format|
23-
format.html do
24-
redirect_to task_path(@task, anchor: "comment-#{@task_comment.id}")
25-
end
25+
format.html
2626
format.js
2727
end
2828
end

app/controllers/task_subscriptions_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def destroy
2828
private
2929

3030
def create_success
31-
notice = "Subscribed to Task ##{@task.id}. You will be notified after "\
31+
notice = "Subscribed to Task ##{@task.id}. You will be notified after " \
3232
'updates.'
3333
respond_to do |format|
3434
format.html { redirect_back fallback_location: @task, notice: notice }

app/helpers/issues_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ def issue_open_status_reviewer_links(issue)
221221
def issue_connection_links(connection)
222222
return unless can?(:destroy, connection)
223223

224-
confirm = 'Are you sure you want to remove the connection to '\
225-
"\"#{connection.target.short_summary}\" and reopen "\
224+
confirm = 'Are you sure you want to remove the connection to ' \
225+
"\"#{connection.target.short_summary}\" and reopen " \
226226
'this issue?'
227227

228228
[['Reopen Issue', connection,

app/helpers/tasks_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ def task_open_status_reviewer_links(task)
200200
def task_connection_links(connection)
201201
return unless can?(:destroy, connection)
202202

203-
confirm = 'Are you sure you want to remove the connection to '\
204-
"\"#{connection.target.short_summary}\" and reopen "\
203+
confirm = 'Are you sure you want to remove the connection to ' \
204+
"\"#{connection.target.short_summary}\" and reopen " \
205205
'this task?'
206206

207207
[['Reopen Task', connection,

app/helpers/users_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def users_page_title(name)
9292

9393
def new_user_header(user)
9494
heading =
95-
"New #{user.employee_type&.present? ? user.employee_type : 'User'}"
95+
"New #{user.employee_type.presence || 'User'}"
9696
content_for :header do
9797
concat user_breadcrumbs
9898
concat content_tag(:h1, heading)

0 commit comments

Comments
 (0)