From 70dbf84b9b3f8c948d82a790424e2321958e1f41 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 25 Oct 2023 08:38:01 -0400 Subject: [PATCH] Solve simplest haml-lint `Rubocop` lints (#27529) --- .haml-lint_todo.yml | 34 ++----------------- app/views/.rubocop.yml | 5 +++ app/views/admin/accounts/_account.html.haml | 2 +- app/views/admin/accounts/show.html.haml | 2 +- .../confirm_suspension.html.haml | 1 - .../admin/software_updates/index.html.haml | 2 +- app/views/admin/tags/show.html.haml | 1 - app/views/admin/trends/tags/_tag.html.haml | 2 +- app/views/auth/registrations/new.html.haml | 1 - app/views/layouts/error.html.haml | 2 +- app/views/statuses_cleanup/show.html.haml | 1 - 11 files changed, 12 insertions(+), 41 deletions(-) create mode 100644 app/views/.rubocop.yml diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml index c3cca9c9a3..7684ab63f7 100644 --- a/.haml-lint_todo.yml +++ b/.haml-lint_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `haml-lint --auto-gen-config` -# on 2023-10-24 14:08:37 -0400 using Haml-Lint version 0.51.0. +# on 2023-10-25 08:29:48 -0400 using Haml-Lint version 0.51.0. # The point is for the user to remove these configuration records # one by one as the lints are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -11,41 +11,11 @@ linters: LineLength: enabled: false - # Offense count: 45 + # Offense count: 10 RuboCop: exclude: - - 'app/views/admin/accounts/_account.html.haml' - 'app/views/admin/accounts/_buttons.html.haml' - 'app/views/admin/accounts/_local_account.html.haml' - - 'app/views/admin/accounts/_remote_account.html.haml' - 'app/views/admin/accounts/index.html.haml' - - 'app/views/admin/accounts/show.html.haml' - - 'app/views/admin/custom_emojis/index.html.haml' - - 'app/views/admin/dashboard/index.html.haml' - - 'app/views/admin/domain_blocks/confirm_suspension.html.haml' - - 'app/views/admin/follow_recommendations/show.html.haml' - - 'app/views/admin/invites/_invite.html.haml' - - 'app/views/admin/invites/index.html.haml' - - 'app/views/admin/ip_blocks/index.html.haml' - - 'app/views/admin/reports/_status.html.haml' - - 'app/views/admin/reports/show.html.haml' - 'app/views/admin/roles/_form.html.haml' - - 'app/views/admin/software_updates/index.html.haml' - - 'app/views/admin/status_edits/_status_edit.html.haml' - - 'app/views/admin/statuses/index.html.haml' - - 'app/views/admin/tags/show.html.haml' - - 'app/views/admin/trends/tags/_tag.html.haml' - - 'app/views/auth/registrations/_session.html.haml' - - 'app/views/auth/registrations/new.html.haml' - - 'app/views/auth/sessions/two_factor.html.haml' - - 'app/views/auth/shared/_progress.html.haml' - - 'app/views/disputes/strikes/_card.html.haml' - - 'app/views/filters/statuses/index.html.haml' - - 'app/views/invites/_invite.html.haml' - 'app/views/layouts/application.html.haml' - - 'app/views/layouts/error.html.haml' - - 'app/views/statuses/_detailed_status.html.haml' - - 'app/views/statuses/_og_image.html.haml' - - 'app/views/statuses/_simple_status.html.haml' - - 'app/views/statuses_cleanup/show.html.haml' - - 'app/views/user_mailer/warning.html.haml' diff --git a/app/views/.rubocop.yml b/app/views/.rubocop.yml new file mode 100644 index 0000000000..4e268848c7 --- /dev/null +++ b/app/views/.rubocop.yml @@ -0,0 +1,5 @@ +inherit_from: ../../.rubocop.yml + +# Disable for the `Rubocop` lints in haml-lint +Style/IfUnlessModifier: + Enabled: false diff --git a/app/views/admin/accounts/_account.html.haml b/app/views/admin/accounts/_account.html.haml index 82dd8dfb2b..755b987a87 100644 --- a/app/views/admin/accounts/_account.html.haml +++ b/app/views/admin/accounts/_account.html.haml @@ -30,6 +30,6 @@ \- %br/ %samp.ellipsized-ip= relevant_account_ip(account, params[:ip]) - - if !account.suspended? && account.user_pending? && account.user&.invite_request&.text&.present? + - if !account.suspended? && account.user_pending? && account.user&.invite_request&.text.present? .batch-table__row__content__quote %p= account.user&.invite_request&.text diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index 80b8fc92c2..da2f2055d0 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -73,7 +73,7 @@ %hr.spacer/ - - if @account.user&.invite_request&.text&.present? + - if @account.user&.invite_request&.text.present? .speech-bubble .speech-bubble__bubble = @account.user&.invite_request&.text diff --git a/app/views/admin/domain_blocks/confirm_suspension.html.haml b/app/views/admin/domain_blocks/confirm_suspension.html.haml index e0e55e70f3..a5df8ba3f3 100644 --- a/app/views/admin/domain_blocks/confirm_suspension.html.haml +++ b/app/views/admin/domain_blocks/confirm_suspension.html.haml @@ -2,7 +2,6 @@ = t('.title', domain: Addressable::IDNA.to_unicode(@domain_block.domain)) = simple_form_for @domain_block, url: admin_domain_blocks_path, method: :post do |f| - %p.hint= t('.preamble_html', domain: Addressable::IDNA.to_unicode(@domain_block.domain)) %ul.hint %li= t('.stop_communication') diff --git a/app/views/admin/software_updates/index.html.haml b/app/views/admin/software_updates/index.html.haml index 7a223ee07b..d2ba115590 100644 --- a/app/views/admin/software_updates/index.html.haml +++ b/app/views/admin/software_updates/index.html.haml @@ -23,7 +23,7 @@ %td= update.version %td= t("admin.software_updates.types.#{update.type}") - if update.urgent? - %td.critical= t("admin.software_updates.critical_update") + %td.critical= t('admin.software_updates.critical_update') - else %td %td= table_link_to 'link', t('admin.software_updates.release_notes'), update.release_notes diff --git a/app/views/admin/tags/show.html.haml b/app/views/admin/tags/show.html.haml index 0878887cea..e4c985c19e 100644 --- a/app/views/admin/tags/show.html.haml +++ b/app/views/admin/tags/show.html.haml @@ -35,7 +35,6 @@ %span= t('admin.trends.tags.not_trendable') = fa_icon 'lock fw' - = link_to admin_tag_path(@tag.id), class: ['dashboard__quick-access', @tag.listable? ? 'positive' : 'negative'] do - if @tag.listable? %span= t('admin.trends.tags.listable') diff --git a/app/views/admin/trends/tags/_tag.html.haml b/app/views/admin/trends/tags/_tag.html.haml index 72f8178ef2..70c7d8dbd4 100644 --- a/app/views/admin/trends/tags/_tag.html.haml +++ b/app/views/admin/trends/tags/_tag.html.haml @@ -10,7 +10,7 @@ %br/ - = link_to tag_path(tag), target: '_blank' do + = link_to tag_path(tag), target: '_blank', rel: 'noopener noreferrer' do = t('admin.trends.tags.used_by_over_week', count: tag.history.reduce(0) { |sum, day| sum + day.accounts }) - if tag.trendable? && (rank = Trends.tags.rank(tag.id)) diff --git a/app/views/auth/registrations/new.html.haml b/app/views/auth/registrations/new.html.haml index c001b66c22..4cac7b51bd 100644 --- a/app/views/auth/registrations/new.html.haml +++ b/app/views/auth/registrations/new.html.haml @@ -33,7 +33,6 @@ = f.simple_fields_for :invite_request, resource.invite_request || resource.build_invite_request do |invite_request_fields| = invite_request_fields.input :text, as: :text, wrapper: :with_block_label, required: Setting.require_invite_text, label: false, hint: false - = hidden_field_tag :accept, params[:accept] = f.input :invite_code, as: :hidden diff --git a/app/views/layouts/error.html.haml b/app/views/layouts/error.html.haml index 852a0c69b6..b7aafe9879 100644 --- a/app/views/layouts/error.html.haml +++ b/app/views/layouts/error.html.haml @@ -1,7 +1,7 @@ !!! %html{ lang: I18n.locale } %head - %meta{ content: 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type' }/ + %meta{ 'content' => 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type' }/ %meta{ charset: 'utf-8' }/ %title= safe_join([yield(:page_title), Setting.default_settings['site_title']], ' - ') %meta{ content: 'width=device-width,initial-scale=1', name: 'viewport' }/ diff --git a/app/views/statuses_cleanup/show.html.haml b/app/views/statuses_cleanup/show.html.haml index 99b9ddab93..bd4cc1d86c 100644 --- a/app/views/statuses_cleanup/show.html.haml +++ b/app/views/statuses_cleanup/show.html.haml @@ -5,7 +5,6 @@ = button_tag t('generic.save_changes'), class: 'button', form: 'edit_policy' = simple_form_for @policy, url: statuses_cleanup_path, method: :put, html: { id: 'edit_policy' } do |f| - .fields-row .fields-row__column.fields-row__column-6.fields-group = f.input :enabled, as: :boolean, wrapper: :with_label, label: t('statuses_cleanup.enabled'), hint: t('statuses_cleanup.enabled_hint')