From df05ece265ab699c856ec62682c920deaf449a49 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 20 Jul 2023 09:13:06 -0400 Subject: [PATCH] Fix haml-lint Rubocop `Style/NumericPredicate` cop (#26040) --- .haml-lint_todo.yml | 6 +++--- app/views/notification_mailer/_status.html.haml | 2 +- app/views/statuses/_poll.html.haml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml index 6cb38fcc2..7c476be80 100644 --- a/.haml-lint_todo.yml +++ b/.haml-lint_todo.yml @@ -1,13 +1,13 @@ # This configuration was generated by # `haml-lint --auto-gen-config` -# on 2023-07-18 12:15:07 -0400 using Haml-Lint version 0.48.0. +# on 2023-07-19 06:41:20 -0400 using Haml-Lint version 0.48.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 # versions of Haml-Lint, may require this file to be generated again. linters: - # Offense count: 950 + # Offense count: 951 LineLength: enabled: false @@ -15,7 +15,7 @@ linters: UnnecessaryStringOutput: enabled: false - # Offense count: 62 + # Offense count: 59 RuboCop: enabled: false diff --git a/app/views/notification_mailer/_status.html.haml b/app/views/notification_mailer/_status.html.haml index 4ea3d2c45..c85253ac0 100644 --- a/app/views/notification_mailer/_status.html.haml +++ b/app/views/notification_mailer/_status.html.haml @@ -33,7 +33,7 @@ .auto-dir = status_content_format(status) - - if status.ordered_media_attachments.size > 0 + - if status.ordered_media_attachments.size.positive? %p - status.ordered_media_attachments.each do |a| - if status.local? diff --git a/app/views/statuses/_poll.html.haml b/app/views/statuses/_poll.html.haml index 21870af44..b537eb48c 100644 --- a/app/views/statuses/_poll.html.haml +++ b/app/views/statuses/_poll.html.haml @@ -8,7 +8,7 @@ - poll.loaded_options.each_with_index do |option, index| %li - if show_results - - percent = total_votes_count > 0 ? 100 * option.votes_count / total_votes_count : 0 + - percent = total_votes_count.positive? ? 100 * option.votes_count / total_votes_count : 0 %label.poll__option>< %span.poll__number>< = "#{percent.round}%"