Commit ee666a3b authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch '228858-resolve-numericpredicate-views' into 'master'

Resolve Style/NumericPredicate Cop exceptions in Views

See merge request gitlab-org/gitlab!38219
parents 6336341b efc37942
...@@ -1026,8 +1026,6 @@ Style/NumericPredicate: ...@@ -1026,8 +1026,6 @@ Style/NumericPredicate:
EnforcedStyle: comparison EnforcedStyle: comparison
Exclude: Exclude:
- 'spec/**/*' - 'spec/**/*'
- 'app/views/**/*'
- 'ee/app/views/**/*'
- 'app/controllers/concerns/issuable_collections.rb' - 'app/controllers/concerns/issuable_collections.rb'
- 'app/controllers/concerns/paginated_collection.rb' - 'app/controllers/concerns/paginated_collection.rb'
- 'app/helpers/graph_helper.rb' - 'app/helpers/graph_helper.rb'
......
- if @labels.size.zero? - if @labels.size == 0
$('.labels').load(document.URL + ' .nothing-here-block').hide().fadeIn(1000) $('.labels').load(document.URL + ' .nothing-here-block').hide().fadeIn(1000)
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
= render_if_exists 'devise/sessions/new_kerberos_tab' = render_if_exists 'devise/sessions/new_kerberos_tab'
- ldap_servers.each_with_index do |server, i| - 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 .login-body
= render 'devise/sessions/new_ldap', server: server, hide_remember_me: true, submit_message: _('Enter Admin Mode') = render 'devise/sessions/new_ldap', server: server, hide_remember_me: true, submit_message: _('Enter Admin Mode')
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
= render_if_exists 'devise/sessions/new_kerberos_tab' = render_if_exists 'devise/sessions/new_kerberos_tab'
- ldap_servers.each_with_index do |server, i| - 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 .login-body
= render 'devise/sessions/new_ldap', server: server = render 'devise/sessions/new_ldap', server: server
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
= render_if_exists "devise/shared/kerberos_tab" = render_if_exists "devise/shared/kerberos_tab"
- ldap_servers.each_with_index do |server, i| - ldap_servers.each_with_index do |server, i|
%li.nav-item %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' = render_if_exists 'devise/shared/tab_smartcard'
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
= content_for :meta_tags do = content_for :meta_tags do
= auto_discovery_link_tag(:atom, safe_params.merge(rss_url_options).to_h, title: "#{@group.name} issues") = 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 = render 'shared/empty_states/issues', project_select_button: true
- else - else
.top-area .top-area
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- page_title _("Merge Requests") - 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 = render 'shared/empty_states/merge_requests', project_select_button: true
- else - else
.top-area .top-area
......
...@@ -38,20 +38,20 @@ ...@@ -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 = 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) = sprite_icon('issues', size: 16)
- issues_count = assigned_issuables_count(:issues) - 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) = number_with_delimiter(issues_count)
- if header_link?(:merge_requests) - if header_link?(:merge_requests)
= nav_link(path: 'dashboard#merge_requests', html_options: { class: "user-counter" }) do = 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 = 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) = sprite_icon('git-merge', size: 16)
- merge_requests_count = assigned_issuables_count(:merge_requests) - 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) = number_with_delimiter(merge_requests_count)
- if header_link?(:todos) - if header_link?(:todos)
= nav_link(controller: 'dashboard/todos', html_options: { class: "user-counter" }) do = 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 = 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) = 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) = todos_count_format(todos_pending_count)
%li.nav-item.header-help.dropdown.d-none.d-md-block %li.nav-item.header-help.dropdown.d-none.d-md-block
= link_to help_path, class: 'header-help-dropdown-toggle', data: { toggle: "dropdown" } do = link_to help_path, class: 'header-help-dropdown-toggle', data: { toggle: "dropdown" } do
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
= render_if_exists 'shared/milestones/burndown', milestone: @milestone, project: @project = 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 .alert.alert-success.gl-mt-3
%span= _('Assign some issues to this milestone.') %span= _('Assign some issues to this milestone.')
- elsif @milestone.complete? && @milestone.active? - elsif @milestone.complete? && @milestone.active?
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
= _('Enable shared Runners') = _('Enable shared Runners')
  for this project   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.') = _('This GitLab instance does not provide any shared Runners yet. Instance administrators can register shared Runners in the admin area.')
- else - else
%h4.underlined-title #{_('Available shared Runners:')} #{@shared_runners_count} %h4.underlined-title #{_('Available shared Runners:')} #{@shared_runners_count}
......
...@@ -20,6 +20,6 @@ ...@@ -20,6 +20,6 @@
= downvotes = downvotes
%li.issuable-comments.d-none.d-sm-block %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') = sprite_icon('comments', size: 16, css_class: 'gl-vertical-align-text-bottom')
= note_count = note_count
...@@ -6,5 +6,5 @@ ...@@ -6,5 +6,5 @@
- issuable.assignees.take(render_count).each do |assignee| # rubocop: disable CodeReuse/ActiveRecord - issuable.assignees.take(render_count).each do |assignee| # rubocop: disable CodeReuse/ActiveRecord
= link_to_member(@project, assignee, name: false, title: "Assigned to :name") = 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} %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}
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
.text-tertiary.gl-mb-2 .text-tertiary.gl-mb-2
= milestone_date_range(milestone) = milestone_date_range(milestone)
- recent_releases, total_count, more_count = recent_releases_with_counts(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 .text-tertiary.gl-mb-2.milestone-release-links
= sprite_icon("rocket", size: 12) = sprite_icon("rocket", size: 12)
= n_('Release', 'Releases', total_count) = n_('Release', 'Releases', total_count)
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
%span= total_count %span= total_count
.title.hide-collapsed= n_('Release', 'Releases', total_count) .title.hide-collapsed= n_('Release', 'Releases', total_count)
.hide-collapsed .hide-collapsed
- if total_count.zero? - if total_count == 0
.no-value= s_('MilestoneSidebar|None') .no-value= s_('MilestoneSidebar|None')
- else - else
.font-weight-bold .font-weight-bold
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
%ul.controls %ul.controls
%li %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') = sprite_icon('comments', size: 16, css_class: 'gl-vertical-align-text-bottom')
= notes_count = notes_count
%li %li
......
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
- link_start = '<a href="%{url}">'.html_safe % { url: help_page_path("user/profile/account/delete_account", anchor: "associated-records") } - 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 } = _('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 - personal_projects_count = user.personal_projects.count
- unless personal_projects_count.zero? - unless personal_projects_count == 0
%li %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 = 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
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
%ul.conditions.p-0.my-auto %ul.conditions.p-0.my-auto
%li= s_("BillingPlans|per user") %li= s_("BillingPlans|per user")
%li= s_("BillingPlans|monthly") %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) - 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 } = s_("BillingPlans|billed annually at %{price_per_year}") % { price_per_year: price_per_year }
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
.sidebar-collapsed-icon.has-tooltip{ title: milestone_weight_tooltip_text(total_weight), data: { container: 'body', placement: 'left' } } .sidebar-collapsed-icon.has-tooltip{ title: milestone_weight_tooltip_text(total_weight), data: { container: 'body', placement: 'left' } }
= sprite_icon('weight', size: 16) = sprite_icon('weight', size: 16)
%span %span
- unless total_weight.zero? - unless total_weight == 0
= total_weight = total_weight
- else - else
None None
.title.hide-collapsed .title.hide-collapsed
Total issue weight Total issue weight
.value.hide-collapsed{ data: { qa_selector: 'total_issue_weight_value' } } .value.hide-collapsed{ data: { qa_selector: 'total_issue_weight_value' } }
- unless total_weight.zero? - unless total_weight == 0
%strong.bold= total_weight %strong.bold= total_weight
- else - else
.no-value None .no-value None
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
= render_if_exists 'devise/sessions/new_kerberos_tab' = render_if_exists 'devise/sessions/new_kerberos_tab'
- ldap_servers.each_with_index do |server, i| - 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 .login-body
= render 'devise/sessions/new_ldap', server: server = render 'devise/sessions/new_ldap', server: server
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment