From 7fddd2dab91984cba703b7b7cdd1113ed49c1ab2 Mon Sep 17 00:00:00 2001 From: nishitatsu-dev Date: Fri, 16 Feb 2024 23:06:45 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=9F=E3=83=83=E3=83=88=E3=82=92?= =?UTF-8?q?=EF=BC=91=E3=81=A4=E3=81=AB=E3=81=BE=E3=81=A8=E3=82=81=E3=81=9F?= =?UTF-8?q?=EF=BC=88=E3=82=B3=E3=83=B3=E3=83=95=E3=83=AA=E3=82=AF=E3=83=88?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C=E3=81=A7=E8=A1=A8=E7=A4=BA=E3=81=A8=E4=B8=AD?= =?UTF-8?q?=E8=BA=AB=E3=81=8C=E3=82=BA=E3=83=AC=E3=81=9F=E7=82=BA=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit slimファイルにRubocopのルール(Style/IdenticalConditionalBranches)を適用 Style/HashSyntaxを適用し、ハッシュの省略記法を使うように修正 ハッシュの省略記法適用で出るエラー対応。検討結果のコメント記載 途中保存、Lint/SyntaxとLint/UselessAssignmentのエラー対応 検討結果のコメント記載 mainブランチのpullで、新たに出てきたファイルにルール適用 今回はエラー出なかったが、未然防止でカッコで囲った Style/HashSyntaxの適用を取りやめ Revert "今回はエラー出なかったが、未然防止でカッコで囲った" This reverts commit f9bf9445bbd9b9a467b8c03b94111111da7e45df. Revert "mainブランチのpullで、新たに出てきたファイルにルール適用" This reverts commit 3c873055d800a8f60fe5f10edc8efb4f8e178623. Revert "ハッシュの省略記法適用で出るエラー対応。検討結果のコメント記載" This reverts commit 706c9f53402c5d737452668c0a897c7bf209e1a1. Revert "Style/HashSyntaxを適用し、ハッシュの省略記法を使うように修正" This reverts commit d9b837ceec297d06d469df02a5afea9ecab9cfaf. 適用しないルールにコメント コンフリクトの解消で間違えた部分を修正 コンフリクトの解消で間違えた部分を修正 --- app/views/home/index.html.slim | 14 +++++-------- app/views/surveys/show.html.slim | 36 +++++++++++++------------------- app/views/users/index.html.slim | 11 +++++----- config/slim_lint.yml | 9 ++++---- 4 files changed, 28 insertions(+), 42 deletions(-) diff --git a/app/views/home/index.html.slim b/app/views/home/index.html.slim index f1a2fc3134b..a77e4c1e33f 100644 --- a/app/views/home/index.html.slim +++ b/app/views/home/index.html.slim @@ -11,16 +11,12 @@ = render 'welcome_message_for_adviser' .page-body.is-dash-board - - if current_user.adviser? - .page-body__inner.has-side-nav + .page-body__inner.has-side-nav + - if current_user.adviser? = render 'adviser_dashboard' - = render partial: 'recent_reports' - - elsif current_user.mentor? - .page-body__inner.has-side-nav + - elsif current_user.mentor? = render 'mentor_dashboard' - = render partial: 'recent_reports' - - else - .page-body__inner.has-side-nav + - else .columns .container.is-xl .row @@ -47,4 +43,4 @@ = render 'users/github_grass', user: current_user - if current_user.student_or_trainee? #js-niconico_calendar(data-user-id="#{current_user.id}") - = render partial: 'recent_reports' + = render partial: 'recent_reports' diff --git a/app/views/surveys/show.html.slim b/app/views/surveys/show.html.slim index d24ec803144..fd422da3feb 100644 --- a/app/views/surveys/show.html.slim +++ b/app/views/surveys/show.html.slim @@ -53,14 +53,12 @@ header.page-header .survey-questions-item__radios.radios ul.radios__items - survey_question.radio_button.radio_button_choices.each do |choice| - - if choice.reason_for_choice_required - li.radios__item + li.radios__item + - if choice.reason_for_choice_required = f.radio_button survey_question.id, choice.choices, id: "radio-#{choice.id}", class: 'a-toggle-checkbox js-questionnaire_choice js-answer_required_choice' - = f.label "#{choice.radio_button_id}_#{choice.choices}", choice.choices, for: "radio-#{choice.id}" - - else - li.radios__item + - else = f.radio_button survey_question.id, choice.choices, id: "radio-#{choice.id}", class: 'a-toggle-checkbox js-questionnaire_choice' - = f.label "#{choice.radio_button_id}_#{choice.choices}", choice.choices, for: "radio-#{choice.id}" + = f.label "#{choice.radio_button_id}_#{choice.choices}", choice.choices, for: "radio-#{choice.id}" - if survey_question.answer_required_choice_exists?(survey_question.id) .survey-additional-question.is-hidden name="js-additional_question_#{survey_question.id}" = f.label survey_question.radio_button.title_of_reason, class: 'a-form-label is-required' @@ -73,14 +71,12 @@ header.page-header .survey-questions-item__checkboxes.checkboxes ul.checkboxes__items - survey_question.check_box.check_box_choices.each do |choice| - - if choice.reason_for_choice_required - li.checkboxes__item + li.checkboxes__item + - if choice.reason_for_choice_required = f.check_box choice.choices, id: "checkbox-#{choice.id}", class: 'a-toggle-checkbox js-questionnaire_choice js-answer_required_choice', name: survey_question.id - = f.label choice.choices, for: "checkbox-#{choice.id}" - - else - li.checkboxes__item + - else = f.check_box choice.choices, id: "checkbox-#{choice.id}", class: 'a-toggle-checkbox js-questionnaire_choice', name: survey_question.id - = f.label choice.choices, for: "checkbox-#{choice.id}" + = f.label choice.choices, for: "checkbox-#{choice.id}" - if survey_question.answer_required_choice_exists?(survey_question.id) .survey-additional-question.is-hidden name="js-additional_question_#{survey_question.id}" = f.label :title_of_reason_for_checkbox, survey_question.check_box.title_of_reason, class: 'a-form-label is-required' @@ -97,20 +93,16 @@ header.page-header .linear-scale__points ul.linear-scale__points-items - 10.times do |i| - - if survey_question.linear_scale.reason_for_choice_required - li.linear-scale__points-item + li.linear-scale__points-item + - if survey_question.linear_scale.reason_for_choice_required = f.radio_button survey_question.id, i + 1, id: "linear-scale-#{survey_question.id}-#{i}", class: 'a-toggle-checkbox js-questionnaire_choice js-answer_required_choice' - label.linear-scale__point for="linear-scale-#{survey_question.id}-#{i}" - .linear-scale__point-number - = i + 1 - - else - li.linear-scale__points-item + - else = f.radio_button survey_question.id, i + 1, id: "linear-scale-#{survey_question.id}-#{i}", class: 'a-toggle-checkbox js-questionnaire_choice' - label.linear-scale__point for="linear-scale-#{survey_question.id}-#{i}" - .linear-scale__point-number - = i + 1 + label.linear-scale__point for="linear-scale-#{survey_question.id}-#{i}" + .linear-scale__point-number + = i + 1 .linear-scale__label = survey_question.linear_scale.last - if survey_question.linear_scale.reason_for_choice_required diff --git a/app/views/users/index.html.slim b/app/views/users/index.html.slim index 54dfac9b95f..cdfe9d82b4a 100644 --- a/app/views/users/index.html.slim +++ b/app/views/users/index.html.slim @@ -36,13 +36,12 @@ main.page-main = link_to 'このタグを自分に追加', "/users/tags/#{params[:tag]}", method: 'post', class: 'a-button is-sm is-secondary is-block' - else h1.page-main-header__title + | #{t("target.#{@target}")} - if @watch - | #{t("target.#{@target}")}:#{t("watch.#{@watch}")}(#{@users.total_count}) - - else - | #{t("target.#{@target}")} - - if admin_or_mentor_login? - span.is-only-mentor - |(#{@users.total_count}) + |:#{t("watch.#{@watch}")}(#{@users.total_count}) + - elsif admin_or_mentor_login? + span.is-only-mentor + |(#{@users.total_count}) hr.a-border .page-body.is-users // TODO 暫定的な対応 diff --git a/config/slim_lint.yml b/config/slim_lint.yml index 6197c001ddf..5969dd15e0c 100644 --- a/config/slim_lint.yml +++ b/config/slim_lint.yml @@ -7,12 +7,12 @@ linters: RuboCop: enabled: true ignored_cops: - - Layout/ArgumentAlignment + - Layout/ArgumentAlignment # 検討の結果、残す。(詳細は issue #7253 参照) - Layout/EmptyLineAfterGuardClause - Layout/EndAlignment - Layout/FirstArrayElementIndentation - Layout/FirstParameterIndentation - - Layout/HashAlignment + - Layout/HashAlignment # 検討の結果、残す。(詳細は issue #7253 参照) - Layout/IndentationWidth - Layout/InitialIndentation - Layout/MultilineArrayBraceLayout @@ -22,13 +22,12 @@ linters: - Layout/MultilineMethodDefinitionBraceLayout - Layout/MultilineOperationIndentation - Layout/ParameterAlignment - - Layout/TrailingEmptyLines + - Layout/TrailingEmptyLines # 検討の結果、残す。(詳細は issue #7253 参照) - Lint/Void # 除外検討したが見送り - Metrics/BlockLength # 除外検討したが見送り - Style/FrozenStringLiteralComment # 除外検討したが見送り - - Style/IdenticalConditionalBranches - Style/IfUnlessModifier # 検討の結果、残す(詳細は#7252) - Style/Next # 検討の結果、残す(詳細は#7252) - Style/WhileUntilDo - Style/WhileUntilModifier - - Style/HashSyntax + - Style/HashSyntax # 検討の結果、残す。(詳細は issue #7253 参照)