diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ba87dd8713a..118c0c326ce 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -23,16 +23,6 @@ Style/HashSyntax: - 'app/controllers/api/session_controller.rb' - 'app/controllers/api/watches/toggle_controller.rb' - 'app/controllers/application_controller.rb' - - 'app/controllers/notifications/read_by_category_controller.rb' - - 'app/controllers/notifications_controller.rb' - - 'app/controllers/products_controller.rb' - - 'app/controllers/user_sessions_controller.rb' - - 'app/helpers/meta_tags_helper.rb' - - 'app/helpers/page_tab_helper.rb' - - 'app/helpers/reactions_helper.rb' - - 'app/jobs/ai_answer_create_job.rb' - - 'app/mailers/activity_mailer.rb' - - 'app/mailers/notification_mailer.rb' - 'app/models/announcement_notifier.rb' - 'app/models/answer.rb' - 'app/models/answer_notifier.rb' diff --git a/app/controllers/notifications/read_by_category_controller.rb b/app/controllers/notifications/read_by_category_controller.rb index def995e9592..9f8c5280c95 100644 --- a/app/controllers/notifications/read_by_category_controller.rb +++ b/app/controllers/notifications/read_by_category_controller.rb @@ -7,6 +7,6 @@ def create target = params[:target].presence&.to_sym notifications = current_user.notifications.by_target(target).unreads current_user.mark_all_as_read_and_delete_cache_of_unreads(target_notifications: notifications) - redirect_to notifications_path(target: target), notice: '既読にしました' + redirect_to notifications_path(target:), notice: '既読にしました' end end diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 011270e45e4..823b08fde2b 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -9,7 +9,7 @@ def index def show link = @notification.read_attribute :link - @notifications = current_user.notifications.where(link: link) + @notifications = current_user.notifications.where(link:) current_user.mark_all_as_read_and_delete_cache_of_unreads(target_notifications: @notifications) redirect_to link end diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index aec239e73b4..8507f9f4290 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -55,7 +55,7 @@ def update set_wip update_published_at if @product.update(product_params) - Newspaper.publish(:product_update, { product: @product, current_user: current_user }) + Newspaper.publish(:product_update, { product: @product, current_user: }) Newspaper.publish(:product_save, { product: @product }) notice_another_mentor_assigned_as_checker redirect_to Redirection.determin_url(self, @product), notice: notice_message(@product, :update) diff --git a/app/controllers/user_sessions_controller.rb b/app/controllers/user_sessions_controller.rb index b29787e7123..3b408ccc193 100644 --- a/app/controllers/user_sessions_controller.rb +++ b/app/controllers/user_sessions_controller.rb @@ -40,7 +40,7 @@ def callback auth = request.env['omniauth.auth'] github_id = auth[:uid] if current_user.blank? - user = User.find_by(github_id: github_id) + user = User.find_by(github_id:) if user.blank? flash[:alert] = 'ログインに失敗しました。先にアカウントを作成後、GitHub連携を行ってください。' redirect_to root_url diff --git a/app/helpers/meta_tags_helper.rb b/app/helpers/meta_tags_helper.rb index b8c5415b52f..2c67c7f2bcf 100644 --- a/app/helpers/meta_tags_helper.rb +++ b/app/helpers/meta_tags_helper.rb @@ -30,7 +30,7 @@ def default_meta_tags def welcome_meta_tags default_meta_tags.deep_merge({ - title: title, + title:, description: '月額29,800円、全機能が使えるお試し期間付き。フィヨルドブートキャンプは現場の即戦力になるためのスキルとプログラミングの楽しさを伝える、現役エンジニアが考える理想のプログラミングスクールの実現に励んでいます。', og: { title: title || 'FJORD BOOT CAMP(フィヨルドブートキャンプ)', diff --git a/app/helpers/page_tab_helper.rb b/app/helpers/page_tab_helper.rb index 426c5e42b2d..f2d28b6e67b 100644 --- a/app/helpers/page_tab_helper.rb +++ b/app/helpers/page_tab_helper.rb @@ -36,10 +36,10 @@ def root_tab(resource) def page_tab_member(path, tab_name, is_products_tab: false) { - path: path, + path:, target_name: tab_name.to_s, display_name: display_tab_name(tab_name), - is_products_tab: is_products_tab + is_products_tab: } end diff --git a/app/helpers/reactions_helper.rb b/app/helpers/reactions_helper.rb index 509d5454157..e3fd75bec6d 100644 --- a/app/helpers/reactions_helper.rb +++ b/app/helpers/reactions_helper.rb @@ -13,7 +13,7 @@ def reactions_attributes(reactionable) end def reaction_attributes(reactionable, kind, only_reacted: true) - attributes = { data: { reaction: { kind: kind } } } + attributes = { data: { reaction: { kind: } } } attributes[:hidden] = reactionable.reaction_count_by(kind).zero? if only_reacted reaction_id = reactionable.find_reaction_id_by(kind, current_user.login_name) diff --git a/app/jobs/ai_answer_create_job.rb b/app/jobs/ai_answer_create_job.rb index a465d4a4091..5c0bc6c6a66 100644 --- a/app/jobs/ai_answer_create_job.rb +++ b/app/jobs/ai_answer_create_job.rb @@ -8,6 +8,6 @@ def perform(question_id:) token = Rails.application.secrets[:open_ai][:access_token] generator = AI::AnswerGenerator.new(open_ai_access_token: token) ai_answer = generator.call("#{question.body}\n#{question.description}") - question.update(ai_answer: ai_answer) + question.update(ai_answer:) end end diff --git a/app/mailers/activity_mailer.rb b/app/mailers/activity_mailer.rb index 3f6366b4407..c6db253ee7b 100644 --- a/app/mailers/activity_mailer.rb +++ b/app/mailers/activity_mailer.rb @@ -34,7 +34,7 @@ def comebacked(args = {}) kind: Notification.kinds[:comebacked] ) subject = "[FBC] #{@sender.login_name}さんが休会から復帰しました。" - mail to: @user.email, subject: subject + mail to: @user.email, subject: end # required params: comment, message, receiver @@ -48,7 +48,7 @@ def came_comment(args = {}) @user = @receiver link = "/#{@comment.commentable_type.downcase.pluralize}/#{@comment.commentable.id}" @link_url = notification_redirector_url( - link: link, + link:, kind: Notification.kinds[:came_comment] ) mail to: @user.email, subject: "[FBC] #{@message}" @@ -67,7 +67,7 @@ def graduated(args = {}) kind: Notification.kinds[:graduated] ) subject = "[FBC] #{@sender.login_name}さんが卒業しました。" - mail to: @user.email, subject: subject + mail to: @user.email, subject: end # required params: answer @@ -95,7 +95,7 @@ def submitted(args = {}) kind: Notification.kinds[:submitted] ) subject = "[FBC] #{@product.user.login_name}さんが#{@product.title}を提出しました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -112,7 +112,7 @@ def post_announcement(args = {}) kind: Notification.kinds[:announced] ) subject = "[FBC] お知らせ「#{@announcement.title}」" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -129,7 +129,7 @@ def came_question(args = {}) kind: Notification.kinds[:came_question] ) subject = "[FBC] #{@sender.login_name}さんから質問「#{@question.title}」が投稿されました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -146,7 +146,7 @@ def retired(args = {}) kind: Notification.kinds[:retired] ) subject = "[FBC] #{@sender.login_name}さんが退会しました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -163,7 +163,7 @@ def checked(args = {}) kind: Notification.kinds[:checked] ) subject = "[FBC] #{@user.login_name}さんの#{@check.checkable.title}を確認しました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -180,7 +180,7 @@ def mentioned(args = {}) kind: Notification.kinds[:mentioned] ) subject = "[FBC] #{@mentionable.where_mention}で#{@mentionable.sender.login_name}さんからメンションがありました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -198,7 +198,7 @@ def create_page(args = {}) ) subject = "[FBC] #{@page.user.login_name}さんがDocsに#{@page.title}を投稿しました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -214,7 +214,7 @@ def moved_up_event_waiting_user(args = {}) kind: Notification.kinds[:moved_up_event_waiting_user] ) subject = "[FBC] #{@event.title}で、補欠から参加に繰り上がりました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -232,7 +232,7 @@ def following_report(args = {}) ) subject = "[FBC] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -253,7 +253,7 @@ def watching_notification(args = {}) @action = @watchable.instance_of?(Question) ? '回答' : 'コメント' subject = "[FBC] #{@watchable.user.login_name}さんの#{@watchable.notification_title}に#{@sender.login_name}さんが#{@action}しました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message end @@ -270,7 +270,7 @@ def assigned_as_checker(args = {}) ) subject = "[FBC] #{@product.user.login_name}さんの提出物#{@product.title}の担当になりました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -288,7 +288,7 @@ def hibernated(args = {}) ) subject = "[FBC] #{@sender.login_name}さんが休会しました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message end @@ -305,7 +305,7 @@ def first_report(args = {}) ) subject = "[FBC] #{@report.user.login_name}さんがはじめての日報を書きました!" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message end @@ -321,7 +321,7 @@ def consecutive_sad_report(args = {}) kind: Notification.kinds[:consecutive_sad_report] ) subject = "[FBC] #{@report.user.login_name}さんが#{User::DEPRESSED_SIZE}回連続でsadアイコンの日報を提出しました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -338,7 +338,7 @@ def update_regular_event(args = {}) ) subject = "[FBC] 定期イベント【#{@regular_event.title}】が更新されました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -356,7 +356,7 @@ def no_correct_answer(args = {}) ) subject = "[FBC] #{@user.login_name}さんの質問【 #{@question.title} 】のベストアンサーがまだ選ばれていません。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -375,7 +375,7 @@ def signed_up(args = {}) ) subject = "[FBC] #{@sender.login_name}さん#{@sender_roles}が新しく入会しました!" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message @@ -393,7 +393,7 @@ def chose_correct_answer(args = {}) ) subject = "[FBC] #{@answer.receiver.login_name}さんの質問【 #{@answer.question.title} 】で#{@answer.sender.login_name}さんの回答がベストアンサーに選ばれました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message end @@ -409,7 +409,7 @@ def product_update(args = {}) kind: Notification.kinds[:product_update] ) subject = "[FBC] #{@product.user.login_name}さんが#{@product.title}を更新しました。" - message = mail to: @user.email, subject: subject + message = mail(to: @user.email, subject:) message.perform_deliveries = @user.mail_notification? && !@user.retired? message diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 18f1b9c548d..eeb7fe87d8b 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -25,16 +25,16 @@ def mentioned @user = @receiver @notification = @user.notifications.find_by(link: @mentionable.path) subject = "[FBC] #{@mentionable.where_mention}で#{@mentionable.sender.login_name}さんからメンションがありました。" - mail to: @user.email, subject: subject + mail to: @user.email, subject: end # required params: check def checked @user = @check.receiver link = "/#{@check.checkable_type.downcase.pluralize}/#{@check.checkable.id}" - @notification = @user.notifications.find_by(link: link) + @notification = @user.notifications.find_by(link:) subject = "[FBC] #{@user.login_name}さんの#{@check.checkable.title}を確認しました。" - mail to: @user.email, subject: subject + mail to: @user.email, subject: end # required params: sender, receiver @@ -42,7 +42,7 @@ def retired @user = @receiver @notification = @user.notifications.find_by(link: "/users/#{@sender.id}") subject = "[FBC] #{@sender.login_name}さんが退会しました。" - mail to: @user.email, subject: subject + mail to: @user.email, subject: end # required params: report, receiver @@ -50,7 +50,7 @@ def trainee_report @user = @receiver @notification = @user.notifications.find_by(link: "/reports/#{@report.id}") subject = "[FBC] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!" - mail to: @user.email, subject: subject + mail to: @user.email, subject: end # required params: page, receiver @@ -58,6 +58,6 @@ def create_page @user = @receiver @notification = @user.notifications.find_by(link: "/pages/#{@page.id}") subject = "[FBC] #{@page.user.login_name}さんがDocsに#{@page.title}を投稿しました。" - mail to: @user.email, subject: subject + mail to: @user.email, subject: end end