diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-26 21:09:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-26 21:09:30 +0300 |
commit | 25eb713a7fdb787a67d74a88a89433839aab5642 (patch) | |
tree | 43cfe6c45530aedfd7f96d6c6d0e5857ce1d5ee3 /rubocop | |
parent | ff89c3c372cd3b317915fb21940f9c8c065d94c0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/gitlab/httparty.rb | 4 | ||||
-rw-r--r-- | rubocop/cop/gitlab/json.rb | 4 | ||||
-rw-r--r-- | rubocop/cop/gitlab/module_with_instance_variables.rb | 4 | ||||
-rw-r--r-- | rubocop/cop/gitlab/predicate_memoization.rb | 6 |
4 files changed, 11 insertions, 7 deletions
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 |