summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-18 21:09:00 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-18 21:09:00 +0000
commit7d46e0437fb6e41b1a597ed159a4c1f2b0beca7b (patch)
tree76fb66c4b5dfa1a84995750a0b0bfc3e43065a87
parentc8deb6a80194f536584bbb6c97d92bff7116c548 (diff)
downloadgitlab-ce-7d46e0437fb6e41b1a597ed159a4c1f2b0beca7b.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.rubocop_todo.yml15
-rw-r--r--app/controllers/concerns/labels_as_hash.rb2
-rw-r--r--app/policies/note_policy.rb2
-rw-r--r--app/services/users/update_canonical_email_service.rb2
-rw-r--r--app/views/projects/runners/_group_runners.html.haml2
-rw-r--r--app/views/projects/runners/_runner.html.haml2
-rw-r--r--app/views/projects/runners/_shared_runners.html.haml2
-rw-r--r--changelogs/unreleased/btn-confirm-runners.yml5
-rw-r--r--changelogs/unreleased/pl-rubocop-todo-redundant-safe-navigation.yml5
-rw-r--r--lib/gitlab/pagination/keyset/order.rb4
-rw-r--r--qa/qa/specs/helpers/quarantine.rb2
-rw-r--r--spec/controllers/boards/issues_controller_spec.rb2
-rw-r--r--spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb12
13 files changed, 31 insertions, 26 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index ffa4ef8bd7b..31393371efd 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -184,21 +184,6 @@ Lint/MixedRegexpCaptureTypes:
Lint/RedundantCopDisableDirective:
Enabled: false
-# Offense count: 9
-# Cop supports --auto-correct.
-# Configuration parameters: AllowedMethods.
-# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
-Lint/RedundantSafeNavigation:
- Exclude:
- - 'app/controllers/concerns/labels_as_hash.rb'
- - 'app/policies/note_policy.rb'
- - 'app/services/users/update_canonical_email_service.rb'
- - 'ee/app/presenters/iteration_presenter.rb'
- - 'ee/app/services/ee/members/destroy_service.rb'
- - 'ee/lib/ee/gitlab/email/handler/reply_processing.rb'
- - 'qa/qa/specs/helpers/quarantine.rb'
- - 'spec/controllers/boards/issues_controller_spec.rb'
-
# Offense count: 1
Lint/SelfAssignment:
Exclude:
diff --git a/app/controllers/concerns/labels_as_hash.rb b/app/controllers/concerns/labels_as_hash.rb
index 1171aa9cf44..e428520f709 100644
--- a/app/controllers/concerns/labels_as_hash.rb
+++ b/app/controllers/concerns/labels_as_hash.rb
@@ -11,7 +11,7 @@ module LabelsAsHash
label_hashes = available_labels.as_json(only: [:title, :color])
- if target&.respond_to?(:labels)
+ if target.respond_to?(:labels)
already_set_labels = available_labels & target.labels
if already_set_labels.present?
titles = already_set_labels.map(&:title)
diff --git a/app/policies/note_policy.rb b/app/policies/note_policy.rb
index 38f0f165376..d9ea7c38f11 100644
--- a/app/policies/note_policy.rb
+++ b/app/policies/note_policy.rb
@@ -76,7 +76,7 @@ class NotePolicy < BasePolicy
def parent_namespace
strong_memoize(:parent_namespace) do
next if @subject.is_a?(PersonalSnippet)
- next @subject.noteable.group if @subject.noteable&.is_a?(Epic)
+ next @subject.noteable.group if @subject.noteable.is_a?(Epic)
@subject.project
end
diff --git a/app/services/users/update_canonical_email_service.rb b/app/services/users/update_canonical_email_service.rb
index 1400fd58eb4..e75452f60fd 100644
--- a/app/services/users/update_canonical_email_service.rb
+++ b/app/services/users/update_canonical_email_service.rb
@@ -7,7 +7,7 @@ module Users
INCLUDED_DOMAINS_PATTERN = [/gmail.com/].freeze
def initialize(user:)
- raise ArgumentError.new("Please provide a user") unless user&.is_a?(User)
+ raise ArgumentError.new("Please provide a user") unless user.is_a?(User)
@user = user
end
diff --git a/app/views/projects/runners/_group_runners.html.haml b/app/views/projects/runners/_group_runners.html.haml
index 6e46423cde0..b37b530c33f 100644
--- a/app/views/projects/runners/_group_runners.html.haml
+++ b/app/views/projects/runners/_group_runners.html.haml
@@ -16,7 +16,7 @@
= link_to toggle_group_runners_project_runners_path(@project), class: 'btn gl-button btn-warning-secondary', method: :post do
= _('Disable group runners')
- else
- = link_to toggle_group_runners_project_runners_path(@project), class: 'btn gl-button btn-success btn-inverted', method: :post do
+ = link_to toggle_group_runners_project_runners_path(@project), class: 'btn gl-button btn-confirm-secondary', method: :post do
= _('Enable group runners')
&nbsp;
= _('for this project')
diff --git a/app/views/projects/runners/_runner.html.haml b/app/views/projects/runners/_runner.html.haml
index 7f5acbbe890..c003a76728b 100644
--- a/app/views/projects/runners/_runner.html.haml
+++ b/app/views/projects/runners/_runner.html.haml
@@ -21,7 +21,7 @@
- if runner.active?
= link_to _('Pause'), pause_project_runner_path(@project, runner), method: :post, class: 'btn gl-button btn-sm btn-danger', data: { confirm: _("Are you sure?") }
- else
- = link_to _('Resume'), resume_project_runner_path(@project, runner), method: :post, class: 'btn gl-button btn-success btn-sm'
+ = link_to _('Resume'), resume_project_runner_path(@project, runner), method: :post, class: 'btn gl-button btn-confirm btn-sm'
- if runner.belongs_to_one_project?
= link_to _('Remove runner'), project_runner_path(@project, runner), data: { confirm: _("Are you sure?") }, method: :delete, class: 'btn gl-button btn-danger btn-sm'
- else
diff --git a/app/views/projects/runners/_shared_runners.html.haml b/app/views/projects/runners/_shared_runners.html.haml
index 484d8f8a40c..fccfca38013 100644
--- a/app/views/projects/runners/_shared_runners.html.haml
+++ b/app/views/projects/runners/_shared_runners.html.haml
@@ -12,7 +12,7 @@
= link_to toggle_shared_runners_project_runners_path(@project), class: 'btn gl-button btn-warning-secondary', method: :post do
= _('Disable shared runners')
- else
- = link_to toggle_shared_runners_project_runners_path(@project), class: 'btn gl-button btn-success', method: :post do
+ = link_to toggle_shared_runners_project_runners_path(@project), class: 'btn gl-button btn-confirm', method: :post do
= _('Enable shared runners')
&nbsp; for this project
diff --git a/changelogs/unreleased/btn-confirm-runners.yml b/changelogs/unreleased/btn-confirm-runners.yml
new file mode 100644
index 00000000000..096c689445f
--- /dev/null
+++ b/changelogs/unreleased/btn-confirm-runners.yml
@@ -0,0 +1,5 @@
+---
+title: Move from btn-success to btn-confirm in runners directory
+merge_request: 56485
+author: Yogi (@yo)
+type: changed
diff --git a/changelogs/unreleased/pl-rubocop-todo-redundant-safe-navigation.yml b/changelogs/unreleased/pl-rubocop-todo-redundant-safe-navigation.yml
new file mode 100644
index 00000000000..7d5831756c7
--- /dev/null
+++ b/changelogs/unreleased/pl-rubocop-todo-redundant-safe-navigation.yml
@@ -0,0 +1,5 @@
+---
+title: Fixes offense Lint/RedundantSafeNavigation
+merge_request: 56884
+author: Shubham Kumar (@imskr)
+type: fixed
diff --git a/lib/gitlab/pagination/keyset/order.rb b/lib/gitlab/pagination/keyset/order.rb
index e8e68a5c4a5..bfb15320b57 100644
--- a/lib/gitlab/pagination/keyset/order.rb
+++ b/lib/gitlab/pagination/keyset/order.rb
@@ -55,14 +55,14 @@ module Gitlab
# scope :created_at_ordered, -> {
# keyset_order = Gitlab::Pagination::Keyset::Order.build([
# Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(
- # attribute: :created_at,
+ # attribute_name: :created_at,
# column_expression: Project.arel_table[:created_at],
# order_expression: Project.arel_table[:created_at].asc,
# distinct: false, # values in the column are not unique
# nullable: :nulls_last # we might see NULL values (bottom)
# ),
# Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(
- # attribute: :id,
+ # attribute_name: :id,
# order_expression: Project.arel_table[:id].asc
# )
# ])
diff --git a/qa/qa/specs/helpers/quarantine.rb b/qa/qa/specs/helpers/quarantine.rb
index d365819057e..ee318ac498d 100644
--- a/qa/qa/specs/helpers/quarantine.rb
+++ b/qa/qa/specs/helpers/quarantine.rb
@@ -52,7 +52,7 @@ module QA
if example.metadata.key?(:quarantine)
quarantine_tag = example.metadata[:quarantine]
- if quarantine_tag&.is_a?(Hash) && quarantine_tag&.key?(:only)
+ if quarantine_tag.is_a?(Hash) && quarantine_tag&.key?(:only)
# If the :quarantine hash contains :only, we respect that.
# For instance `quarantine: { only: { subdomain: :staging } }` will only quarantine the test when it runs against staging.
return unless Runtime::Env.context_matches?(quarantine_tag[:only])
diff --git a/spec/controllers/boards/issues_controller_spec.rb b/spec/controllers/boards/issues_controller_spec.rb
index a7f3ab0089f..d23f099e382 100644
--- a/spec/controllers/boards/issues_controller_spec.rb
+++ b/spec/controllers/boards/issues_controller_spec.rb
@@ -404,7 +404,7 @@ RSpec.describe Boards::IssuesController do
list_id: list.try(:to_param)
}
- unless board.try(:parent)&.is_a?(Group)
+ unless board.try(:parent).is_a?(Group)
params[:namespace_id] = project.namespace.to_param
params[:project_id] = project
end
diff --git a/spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb b/spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb
index f78ea364147..eaeb5faee3b 100644
--- a/spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb
+++ b/spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb
@@ -44,7 +44,7 @@
# end
# end
#
-RSpec.shared_examples 'sorted paginated query' do
+RSpec.shared_examples 'sorted paginated query' do |conditions = {}|
# Provided as a convenience when constructing queries using string concatenation
let(:page_info) { 'pageInfo { startCursor endCursor }' }
# Convenience for using default implementation of pagination_results_data
@@ -123,6 +123,16 @@ RSpec.shared_examples 'sorted paginated query' do
expect(results).to eq first_page
end
end
+
+ context 'when last and sort params are present', if: conditions[:is_reversible] do
+ let(:params) { sort_argument.merge(last: 1) }
+
+ it 'fetches last elements without error' do
+ post_graphql(pagination_query(params), current_user: current_user)
+
+ expect(results.first).to eq(expected_results.last)
+ end
+ end
end
end
end