From 25eb713a7fdb787a67d74a88a89433839aab5642 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 26 Jan 2021 18:09:30 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- rubocop/cop/gitlab/httparty.rb | 4 ++-- rubocop/cop/gitlab/json.rb | 4 ++-- rubocop/cop/gitlab/module_with_instance_variables.rb | 4 +++- rubocop/cop/gitlab/predicate_memoization.rb | 6 ++++-- 4 files changed, 11 insertions(+), 7 deletions(-) (limited to 'rubocop') diff --git a/rubocop/cop/gitlab/httparty.rb b/rubocop/cop/gitlab/httparty.rb index 8acebff624d..20f0c381e11 100644 --- a/rubocop/cop/gitlab/httparty.rb +++ b/rubocop/cop/gitlab/httparty.rb @@ -4,13 +4,13 @@ module RuboCop module Cop module Gitlab class HTTParty < RuboCop::Cop::Cop - MSG_SEND = <<~EOL.freeze + MSG_SEND = <<~EOL Avoid calling `HTTParty` directly. Instead, use the Gitlab::HTTP wrapper. To allow request to localhost or the private network set the option :allow_local_requests in the request call. EOL - MSG_INCLUDE = <<~EOL.freeze + MSG_INCLUDE = <<~EOL Avoid including `HTTParty` directly. Instead, use the Gitlab::HTTP wrapper. To allow request to localhost or the private network set the option :allow_local_requests in the request call. diff --git a/rubocop/cop/gitlab/json.rb b/rubocop/cop/gitlab/json.rb index 8c9027223aa..7cc719aca09 100644 --- a/rubocop/cop/gitlab/json.rb +++ b/rubocop/cop/gitlab/json.rb @@ -4,7 +4,7 @@ module RuboCop module Cop module Gitlab class Json < RuboCop::Cop::Cop - MSG_SEND = <<~EOL.freeze + MSG = <<~EOL Avoid calling `JSON` directly. Instead, use the `Gitlab::Json` wrapper. This allows us to alter the JSON parser being used. EOL @@ -14,7 +14,7 @@ module RuboCop PATTERN def on_send(node) - add_offense(node, location: :expression, message: MSG_SEND) if json_node?(node) + add_offense(node) if json_node?(node) end def autocorrect(node) diff --git a/rubocop/cop/gitlab/module_with_instance_variables.rb b/rubocop/cop/gitlab/module_with_instance_variables.rb index dd8bd2dfdf0..40cdc0d3a57 100644 --- a/rubocop/cop/gitlab/module_with_instance_variables.rb +++ b/rubocop/cop/gitlab/module_with_instance_variables.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + module RuboCop module Cop module Gitlab class ModuleWithInstanceVariables < RuboCop::Cop::Cop - MSG = <<~EOL.freeze + MSG = <<~EOL Do not use instance variables in a module. Please read this for the rationale behind it: diff --git a/rubocop/cop/gitlab/predicate_memoization.rb b/rubocop/cop/gitlab/predicate_memoization.rb index 3c25d61d087..4c851f90238 100644 --- a/rubocop/cop/gitlab/predicate_memoization.rb +++ b/rubocop/cop/gitlab/predicate_memoization.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + module RuboCop module Cop module Gitlab class PredicateMemoization < RuboCop::Cop::Cop - MSG = <<~EOL.freeze + MSG = <<~EOL Avoid using `@value ||= query` inside predicate methods in order to properly memoize `false` or `nil` values. https://docs.gitlab.com/ee/development/utilities.html#strongmemoize @@ -12,7 +14,7 @@ module RuboCop return unless predicate_method?(node) select_offenses(node).each do |offense| - add_offense(offense, location: :expression) + add_offense(offense) end end -- cgit v1.2.3