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: LineLength:
enabled: false 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 # Offense count: 45
RuboCop: RuboCop:
exclude: exclude:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
%td %td
%span{ title: session.user_agent }< %span{ title: session.user_agent }<
= fa_icon "#{session_device_icon(session)} fw", 'aria-label': session_device_icon(session) = 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) = 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 %td
%samp= session.ip %samp= session.ip

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,10 +41,10 @@
%tr %tr
%td.column-cell.text-center %td.column-cell.text-center
%p %p
%strong= "#{t('sessions.ip')}:" %strong #{t('sessions.ip')}:
= @remote_ip = @remote_ip
%br/ %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) %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/ %br/
= l(@timestamp.in_time_zone(@resource.time_zone.presence), format: :with_time_zone) = 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: '' = image_tag full_pack_url('media/images/mailer/icon_lock_open.png'), alt: ''
%h1= t 'devise.mailer.webauthn_credential.added.title' %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 %p.lead= @webauthn_credential.nickname
%table.email-table{ cellspacing: 0, cellpadding: 0 } %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: '' = image_tag full_pack_url('media/images/mailer/icon_lock_open.png'), alt: ''
%h1= t 'devise.mailer.webauthn_credential.deleted.title' %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 %p.lead= @webauthn_credential.nickname
%table.email-table{ cellspacing: 0, cellpadding: 0 } %table.email-table{ cellspacing: 0, cellpadding: 0 }

View File

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