Fix haml-lint `UnnecessaryStringOutput` for views (#27531)

This commit is contained in:
Matt Jankowski 2023-10-25 08:01:00 -04:00 committed by GitHub
parent c85e0a6b04
commit c926f5fd67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 22 additions and 42 deletions

View File

@ -11,26 +11,6 @@ linters:
LineLength:
enabled: false
# Offense count: 22
UnnecessaryStringOutput:
exclude:
- 'app/views/accounts/show.html.haml'
- 'app/views/admin/custom_emojis/_custom_emoji.html.haml'
- 'app/views/admin/relays/_relay.html.haml'
- 'app/views/admin/rules/_rule.html.haml'
- 'app/views/admin/statuses/index.html.haml'
- 'app/views/auth/registrations/_session.html.haml'
- 'app/views/disputes/strikes/show.html.haml'
- 'app/views/notification_mailer/_status.html.haml'
- 'app/views/settings/two_factor_authentication_methods/index.html.haml'
- 'app/views/statuses/_detailed_status.html.haml'
- 'app/views/statuses/_poll.html.haml'
- 'app/views/statuses/_simple_status.html.haml'
- 'app/views/user_mailer/suspicious_sign_in.html.haml'
- 'app/views/user_mailer/webauthn_credential_added.html.haml'
- 'app/views/user_mailer/webauthn_credential_deleted.html.haml'
- 'app/views/user_mailer/welcome.html.haml'
# Offense count: 45
RuboCop:
exclude:

View File

@ -1,5 +1,5 @@
- content_for :page_title do
= "#{display_name(@account)} (#{acct(@account)})"
#{display_name(@account)} (#{acct(@account)})
- content_for :header_tags do
- if @account.user_prefers_noindex?

View File

@ -6,7 +6,7 @@
= custom_emoji_tag(custom_emoji)
.batch-table__row__content__text
%samp= ":#{custom_emoji.shortcode}:"
%samp :#{custom_emoji.shortcode}:
- if custom_emoji.local?
%span.information-badge= custom_emoji.category&.name || t('admin.custom_emojis.uncategorized')

View File

@ -5,16 +5,16 @@
- if relay.accepted?
%span.positive-hint
= fa_icon('check')
= ' '
 
= t 'admin.relays.enabled'
- elsif relay.pending?
= fa_icon('hourglass')
= ' '
 
= t 'admin.relays.pending'
- else
%span.negative-hint
= fa_icon('times')
= ' '
 
= t 'admin.relays.disabled'
%td
- if relay.accepted?

View File

@ -1,6 +1,6 @@
.announcements-list__item
= link_to edit_admin_rule_path(rule), class: 'announcements-list__item__title' do
= "#{rule_counter + 1}."
#{rule_counter + 1}.
= truncate(rule.text)
.announcements-list__item__action-bar

View File

@ -1,7 +1,7 @@
- content_for :page_title do
= t('admin.statuses.title')
\-
= "@#{@account.pretty_acct}"
@#{@account.pretty_acct}
.filters
.filter-subset

View File

@ -2,7 +2,7 @@
%td
%span{ title: session.user_agent }<
= fa_icon "#{session_device_icon(session)} fw", 'aria-label': session_device_icon(session)
= ' '
&nbsp;
= t 'sessions.description', browser: t("sessions.browsers.#{session.browser}", default: session.browser.to_s), platform: t("sessions.platforms.#{session.platform}", default: session.platform.to_s)
%td
%samp= session.ip

View File

@ -10,13 +10,13 @@
%p.hint
%span.positive-hint
= fa_icon 'check'
= ' '
&nbsp;
= t 'disputes.strikes.appeal_approved'
- elsif @appeal.persisted? && @appeal.rejected?
%p.hint
%span.negative-hint
= fa_icon 'times'
= ' '
&nbsp;
= t 'disputes.strikes.appeal_rejected'
.report-header

View File

@ -23,7 +23,7 @@
= image_tag full_asset_url(status.account.avatar.url), alt: ''
%td{ align: 'left' }
%bdi= display_name(status.account)
= "@#{status.account.pretty_acct}"
@#{status.account.pretty_acct}
- if status.spoiler_text?
.auto-dir

View File

@ -7,7 +7,7 @@
%p.hint
%span.positive-hint
= fa_icon 'check'
= ' '
&nbsp;
= t 'two_factor_authentication.enabled'
.table-wrapper

View File

@ -62,18 +62,18 @@
- else
= fa_icon('reply-all')
%span.detailed-status__reblogs>= friendly_number_to_human status.replies_count
= ' '
&nbsp;
·
- if status.public_visibility? || status.unlisted_visibility?
%span.detailed-status__link
= fa_icon('retweet')
%span.detailed-status__reblogs>= friendly_number_to_human status.reblogs_count
= ' '
&nbsp;
·
%span.detailed-status__link
= fa_icon('star')
%span.detailed-status__favorites>= friendly_number_to_human status.favourites_count
= ' '
&nbsp;
- if user_signed_in?
·

View File

@ -11,7 +11,7 @@
- percent = total_votes_count.positive? ? 100 * option.votes_count / total_votes_count : 0
%label.poll__option><
%span.poll__number><
= "#{percent.round}%"
#{percent.round}%
%span.poll__option__text
= prerender_custom_emojis(h(option.title), status.emojis)
- if own_votes.include?(index)

View File

@ -23,7 +23,7 @@
%span.display-name
%bdi
%strong.display-name__html.p-name.emojify= display_name(status.account, custom_emojify: true, autoplay: prefers_autoplay?)
= ' '
&nbsp;
%span.display-name__account
= acct(status.account)
= fa_icon('lock') if status.account.locked?

View File

@ -41,10 +41,10 @@
%tr
%td.column-cell.text-center
%p
%strong= "#{t('sessions.ip')}:"
%strong #{t('sessions.ip')}:
= @remote_ip
%br/
%strong= "#{t('sessions.browser')}:"
%strong #{t('sessions.browser')}:
%span{ title: @user_agent }= t 'sessions.description', browser: t("sessions.browsers.#{@detection.id}", default: @detection.id.to_s), platform: t("sessions.platforms.#{@detection.platform.id}", default: @detection.platform.id.to_s)
%br/
= l(@timestamp.in_time_zone(@resource.time_zone.presence), format: :with_time_zone)

View File

@ -20,7 +20,7 @@
= image_tag full_pack_url('media/images/mailer/icon_lock_open.png'), alt: ''
%h1= t 'devise.mailer.webauthn_credential.added.title'
%p.lead= "#{t('devise.mailer.webauthn_credential.added.explanation')}:"
%p.lead #{t('devise.mailer.webauthn_credential.added.explanation')}:
%p.lead= @webauthn_credential.nickname
%table.email-table{ cellspacing: 0, cellpadding: 0 }

View File

@ -20,7 +20,7 @@
= image_tag full_pack_url('media/images/mailer/icon_lock_open.png'), alt: ''
%h1= t 'devise.mailer.webauthn_credential.deleted.title'
%p.lead= "#{t('devise.mailer.webauthn_credential.deleted.explanation')}:"
%p.lead #{t('devise.mailer.webauthn_credential.deleted.explanation')}:
%p.lead= @webauthn_credential.nickname
%table.email-table{ cellspacing: 0, cellpadding: 0 }

View File

@ -41,7 +41,7 @@
%table.input{ align: 'center', cellspacing: 0, cellpadding: 0 }
%tbody
%tr
%td= "@#{@resource.account.username}@#{@instance}"
%td @#{@resource.account.username}@#{@instance}
.col-3
%table.column{ cellspacing: 0, cellpadding: 0 }
%tbody