diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3e0c2838252c358c1c9c42732d78dd82676aecca..f18cd6a297ac0e5c5a7e49dab1f065d3a5d43103 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1026,8 +1026,6 @@ Style/NumericPredicate: EnforcedStyle: comparison Exclude: - 'spec/**/*' - - 'app/views/**/*' - - 'ee/app/views/**/*' - 'app/controllers/concerns/issuable_collections.rb' - 'app/controllers/concerns/paginated_collection.rb' - 'app/helpers/graph_helper.rb' diff --git a/app/views/admin/labels/destroy.js.haml b/app/views/admin/labels/destroy.js.haml index 394d3c11f3154e5c6119ac8a0e0f700c5e97c3d3..b9b63829f254412a11bcaeab87ffc668af3f8355 100644 --- a/app/views/admin/labels/destroy.js.haml +++ b/app/views/admin/labels/destroy.js.haml @@ -1,2 +1,2 @@ -- if @labels.size.zero? +- if @labels.size == 0 $('.labels').load(document.URL + ' .nothing-here-block').hide().fadeIn(1000) diff --git a/app/views/admin/sessions/_signin_box.html.haml b/app/views/admin/sessions/_signin_box.html.haml index cb6c0a76e56415122f98f3df2c2bc48c2586b088..ab7eb8c79dc2be45e8d4d6150db41b5128f71fb1 100644 --- a/app/views/admin/sessions/_signin_box.html.haml +++ b/app/views/admin/sessions/_signin_box.html.haml @@ -7,7 +7,7 @@ = render_if_exists 'devise/sessions/new_kerberos_tab' - ldap_servers.each_with_index do |server, i| - .login-box.tab-pane{ id: "#{server['provider_name']}", role: 'tabpanel', class: active_when(i.zero? && form_based_auth_provider_has_active_class?(:ldapmain)) } + .login-box.tab-pane{ id: "#{server['provider_name']}", role: 'tabpanel', class: active_when(i == 0 && form_based_auth_provider_has_active_class?(:ldapmain)) } .login-body = render 'devise/sessions/new_ldap', server: server, hide_remember_me: true, submit_message: _('Enter Admin Mode') diff --git a/app/views/devise/shared/_signin_box.html.haml b/app/views/devise/shared/_signin_box.html.haml index c0b005bac77336a31b417e75828e0dc0650f595f..d217b47527a8c5b5d07ad473cc1ac2c7d7dd827c 100644 --- a/app/views/devise/shared/_signin_box.html.haml +++ b/app/views/devise/shared/_signin_box.html.haml @@ -7,7 +7,7 @@ = render_if_exists 'devise/sessions/new_kerberos_tab' - ldap_servers.each_with_index do |server, i| - .login-box.tab-pane{ id: "#{server['provider_name']}", role: 'tabpanel', class: active_when(i.zero? && form_based_auth_provider_has_active_class?(:ldapmain)) } + .login-box.tab-pane{ id: "#{server['provider_name']}", role: 'tabpanel', class: active_when(i == 0 && form_based_auth_provider_has_active_class?(:ldapmain)) } .login-body = render 'devise/sessions/new_ldap', server: server diff --git a/app/views/devise/shared/_tabs_ldap.html.haml b/app/views/devise/shared/_tabs_ldap.html.haml index eb14ad6006fb0d94dc1117cf6043f43e5d02d127..acd41fb011a3c5055bc15937934ad388c8146c6e 100644 --- a/app/views/devise/shared/_tabs_ldap.html.haml +++ b/app/views/devise/shared/_tabs_ldap.html.haml @@ -8,7 +8,7 @@ = render_if_exists "devise/shared/kerberos_tab" - ldap_servers.each_with_index do |server, i| %li.nav-item - = link_to server['label'], "##{server['provider_name']}", class: "nav-link #{active_when(i.zero? && form_based_auth_provider_has_active_class?(:ldapmain))}", data: { toggle: 'tab', qa_selector: 'ldap_tab' } + = link_to server['label'], "##{server['provider_name']}", class: "nav-link #{active_when(i == 0 && form_based_auth_provider_has_active_class?(:ldapmain))}", data: { toggle: 'tab', qa_selector: 'ldap_tab' } = render_if_exists 'devise/shared/tab_smartcard' diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 59432e5f01554230b4e220062896dd8a0ddc0b9b..04e0ff30dc9080ae1e2b5dfaa2842dbfda79433c 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -4,7 +4,7 @@ = content_for :meta_tags do = auto_discovery_link_tag(:atom, safe_params.merge(rss_url_options).to_h, title: "#{@group.name} issues") -- if group_issues_count(state: 'all').zero? +- if group_issues_count(state: 'all') == 0 = render 'shared/empty_states/issues', project_select_button: true - else .top-area diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index 1828f850d35ff296924b2356e00effa8bc0d333c..15e777f5c3645e75c2fc124083985cb8cf68d3fb 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -2,7 +2,7 @@ - page_title _("Merge Requests") -- if group_merge_requests_count(state: 'all').zero? +- if group_merge_requests_count(state: 'all') == 0 = render 'shared/empty_states/merge_requests', project_select_button: true - else .top-area diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index c65357b76ca84b29e20a3679d88bafa0f38b2076..0d21f224a8acd970dc819d61af7cbc4df11ab561 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -38,20 +38,20 @@ = link_to assigned_issues_dashboard_path, title: _('Issues'), class: 'dashboard-shortcuts-issues', aria: { label: _('Issues') }, data: { qa_selector: 'issues_shortcut_button', toggle: 'tooltip', placement: 'bottom', container: 'body' } do = sprite_icon('issues', size: 16) - issues_count = assigned_issuables_count(:issues) - %span.badge.badge-pill.issues-count.green-badge{ class: ('hidden' if issues_count.zero?) } + %span.badge.badge-pill.issues-count.green-badge{ class: ('hidden' if issues_count == 0) } = number_with_delimiter(issues_count) - if header_link?(:merge_requests) = nav_link(path: 'dashboard#merge_requests', html_options: { class: "user-counter" }) do = link_to assigned_mrs_dashboard_path, title: _('Merge requests'), class: 'dashboard-shortcuts-merge_requests', aria: { label: _('Merge requests') }, data: { qa_selector: 'merge_requests_shortcut_button', toggle: 'tooltip', placement: 'bottom', container: 'body' } do = sprite_icon('git-merge', size: 16) - merge_requests_count = assigned_issuables_count(:merge_requests) - %span.badge.badge-pill.merge-requests-count{ class: ('hidden' if merge_requests_count.zero?) } + %span.badge.badge-pill.merge-requests-count{ class: ('hidden' if merge_requests_count == 0) } = number_with_delimiter(merge_requests_count) - if header_link?(:todos) = nav_link(controller: 'dashboard/todos', html_options: { class: "user-counter" }) do = link_to dashboard_todos_path, title: _('To-Do List'), aria: { label: _('To-Do List') }, class: 'shortcuts-todos', data: { qa_selector: 'todos_shortcut_button', toggle: 'tooltip', placement: 'bottom', container: 'body' } do = sprite_icon('todo-done', size: 16) - %span.badge.badge-pill.todos-count{ class: ('hidden' if todos_pending_count.zero?) } + %span.badge.badge-pill.todos-count{ class: ('hidden' if todos_pending_count == 0) } = todos_count_format(todos_pending_count) %li.nav-item.header-help.dropdown.d-none.d-md-block = link_to help_path, class: 'header-help-dropdown-toggle', data: { toggle: "dropdown" } do diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index 5239af82ba6509a21573a3f0c89daa6af339f2b5..99e626161c4f866140920b22fca6d86959d2bda3 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -8,7 +8,7 @@ = render_if_exists 'shared/milestones/burndown', milestone: @milestone, project: @project -- if can?(current_user, :read_issue, @project) && @milestone.total_issues_count.zero? +- if can?(current_user, :read_issue, @project) && @milestone.total_issues_count == 0 .alert.alert-success.gl-mt-3 %span= _('Assign some issues to this milestone.') - elsif @milestone.complete? && @milestone.active? diff --git a/app/views/projects/runners/_shared_runners.html.haml b/app/views/projects/runners/_shared_runners.html.haml index 080b2c0b0e92976079de22b8e0822264a5b6a412..8a17ca3c6701c07c55094152b3f89d188e344cba 100644 --- a/app/views/projects/runners/_shared_runners.html.haml +++ b/app/views/projects/runners/_shared_runners.html.haml @@ -15,7 +15,7 @@ = _('Enable shared Runners') for this project -- if @shared_runners_count.zero? +- if @shared_runners_count == 0 = _('This GitLab instance does not provide any shared Runners yet. Instance administrators can register shared Runners in the admin area.') - else %h4.underlined-title #{_('Available shared Runners:')} #{@shared_runners_count} diff --git a/app/views/shared/_issuable_meta_data.html.haml b/app/views/shared/_issuable_meta_data.html.haml index d704eae2090ecfe2e974ea2733b5135624920e83..c1749e1f96e1fe682e63721e21f821957c7a862b 100644 --- a/app/views/shared/_issuable_meta_data.html.haml +++ b/app/views/shared/_issuable_meta_data.html.haml @@ -20,6 +20,6 @@ = downvotes %li.issuable-comments.d-none.d-sm-block - = link_to issuable_path, class: ['has-tooltip', ('no-comments' if note_count.zero?)], title: _('Comments') do + = link_to issuable_path, class: ['has-tooltip', ('no-comments' if note_count == 0)], title: _('Comments') do = sprite_icon('comments', size: 16, css_class: 'gl-vertical-align-text-bottom') = note_count diff --git a/app/views/shared/issuable/_assignees.html.haml b/app/views/shared/issuable/_assignees.html.haml index 7ef0647d14b541f822c5cc5f9439ea6037c4e8c1..8e46db6dea2ef9a058f5c1f27f20f6e4b67f189a 100644 --- a/app/views/shared/issuable/_assignees.html.haml +++ b/app/views/shared/issuable/_assignees.html.haml @@ -6,5 +6,5 @@ - issuable.assignees.take(render_count).each do |assignee| # rubocop: disable CodeReuse/ActiveRecord = link_to_member(@project, assignee, name: false, title: "Assigned to :name") -- if more_assignees_count.positive? +- if more_assignees_count > 0 %span{ class: 'avatar-counter has-tooltip', data: { container: 'body', placement: 'bottom', 'line-type' => 'old', 'original-title' => "+#{more_assignees_count} more assignees", qa_selector: 'avatar_counter_content' } } +#{more_assignees_count} diff --git a/app/views/shared/milestones/_milestone.html.haml b/app/views/shared/milestones/_milestone.html.haml index ae5bf9572bdad3fb596c13b97826ebb8e4419717..4ef8a9dd842741e29ce5d9dc5d42080c1bab3f9b 100644 --- a/app/views/shared/milestones/_milestone.html.haml +++ b/app/views/shared/milestones/_milestone.html.haml @@ -15,7 +15,7 @@ .text-tertiary.gl-mb-2 = milestone_date_range(milestone) - recent_releases, total_count, more_count = recent_releases_with_counts(milestone) - - unless total_count.zero? + - unless total_count == 0 .text-tertiary.gl-mb-2.milestone-release-links = sprite_icon("rocket", size: 12) = n_('Release', 'Releases', total_count) diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index 7fd657ec2ddb9d93692f63fd4859d2374832efba..27cedcae9b660abcf22d75ad2b9557fb26253745 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -144,7 +144,7 @@ %span= total_count .title.hide-collapsed= n_('Release', 'Releases', total_count) .hide-collapsed - - if total_count.zero? + - if total_count == 0 .no-value= s_('MilestoneSidebar|None') - else .font-weight-bold diff --git a/app/views/shared/snippets/_snippet.html.haml b/app/views/shared/snippets/_snippet.html.haml index 5f2c896f68f9c69d1884b677607a5afe3b6c11ab..cf027252524e1726a4fa256d5a5c84dc6650a705 100644 --- a/app/views/shared/snippets/_snippet.html.haml +++ b/app/views/shared/snippets/_snippet.html.haml @@ -10,7 +10,7 @@ %ul.controls %li - = link_to gitlab_snippet_path(snippet, anchor: 'notes'), class: ('no-comments' if notes_count.zero?) do + = link_to gitlab_snippet_path(snippet, anchor: 'notes'), class: ('no-comments' if notes_count == 0) do = sprite_icon('comments', size: 16, css_class: 'gl-vertical-align-text-bottom') = notes_count %li diff --git a/app/views/users/_deletion_guidance.html.haml b/app/views/users/_deletion_guidance.html.haml index 0024801dbf694c1239f6338a65c2fabd7786f813..507fe126acbd04317bce61f7abbb83fad3a2bac6 100644 --- a/app/views/users/_deletion_guidance.html.haml +++ b/app/views/users/_deletion_guidance.html.haml @@ -6,6 +6,6 @@ - link_start = '<a href="%{url}">'.html_safe % { url: help_page_path("user/profile/account/delete_account", anchor: "associated-records") } = _('Certain user content will be moved to a system-wide "Ghost User" in order to maintain content for posterity. For further information, please refer to the %{link_start}user account deletion documentation.%{link_end}').html_safe % { link_start: link_start, link_end: '</a>'.html_safe } - personal_projects_count = user.personal_projects.count - - unless personal_projects_count.zero? + - unless personal_projects_count == 0 %li = n_('%d personal project will be removed and cannot be restored.', '%d personal projects will be removed and cannot be restored.', personal_projects_count) % personal_projects_count diff --git a/ee/app/views/shared/billings/_billing_plan.html.haml b/ee/app/views/shared/billings/_billing_plan.html.haml index a6db040822cbc43459218e7f471c8714f4e8dd1d..e67e2cdf595632ebe558ee64fe0b74f6e3c96c97 100644 --- a/ee/app/views/shared/billings/_billing_plan.html.haml +++ b/ee/app/views/shared/billings/_billing_plan.html.haml @@ -17,7 +17,7 @@ %ul.conditions.p-0.my-auto %li= s_("BillingPlans|per user") %li= s_("BillingPlans|monthly") - .price-per-year.text-left{ class: ("invisible" unless plan.price_per_year.positive?) } + .price-per-year.text-left{ class: ("invisible" unless plan.price_per_year > 0) } - price_per_year = number_to_plan_currency(plan.price_per_year) = s_("BillingPlans|billed annually at %{price_per_year}") % { price_per_year: price_per_year } diff --git a/ee/app/views/shared/milestones/_weight.html.haml b/ee/app/views/shared/milestones/_weight.html.haml index f33fe81830891cb5d200f5133af71b3263db1c44..f03b0fbdc672403559e8e00dc32f0e242c4b3432 100644 --- a/ee/app/views/shared/milestones/_weight.html.haml +++ b/ee/app/views/shared/milestones/_weight.html.haml @@ -7,14 +7,14 @@ .sidebar-collapsed-icon.has-tooltip{ title: milestone_weight_tooltip_text(total_weight), data: { container: 'body', placement: 'left' } } = sprite_icon('weight', size: 16) %span - - unless total_weight.zero? + - unless total_weight == 0 = total_weight - else None .title.hide-collapsed Total issue weight .value.hide-collapsed{ data: { qa_selector: 'total_issue_weight_value' } } - - unless total_weight.zero? + - unless total_weight == 0 %strong.bold= total_weight - else .no-value None diff --git a/ee/app/views/trial_registrations/_signin_box.html.haml b/ee/app/views/trial_registrations/_signin_box.html.haml index 2db891dfc9a592c7038796c8b563b5b4efbe4e23..f3e62a03d0f6ba6f17a0a5377be950486e6c8db0 100644 --- a/ee/app/views/trial_registrations/_signin_box.html.haml +++ b/ee/app/views/trial_registrations/_signin_box.html.haml @@ -7,7 +7,7 @@ = render_if_exists 'devise/sessions/new_kerberos_tab' - ldap_servers.each_with_index do |server, i| - .login-box.tab-pane{ id: "#{server['provider_name']}", role: 'tabpanel', class: active_when(i.zero? && form_based_auth_provider_has_active_class?(:ldapmain)) } + .login-box.tab-pane{ id: "#{server['provider_name']}", role: 'tabpanel', class: active_when(i == 0 && form_based_auth_provider_has_active_class?(:ldapmain)) } .login-body = render 'devise/sessions/new_ldap', server: server