diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-03 18:11:17 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-03 18:11:17 +0000 |
commit | 44434461b3c58336624125b5ab002e7200e4a208 (patch) | |
tree | cef2ea602e94abd9c1ef6ee77b6988c4c85475b7 /rubocop | |
parent | e6fa9529b4922a4c552e8908a2929ff995e8b53d (diff) | |
download | gitlab-ce-44434461b3c58336624125b5ab002e7200e4a208.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/gitlab/json.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/rubocop/cop/gitlab/json.rb b/rubocop/cop/gitlab/json.rb index 32bfdd9bfdc..d27c8dab66c 100644 --- a/rubocop/cop/gitlab/json.rb +++ b/rubocop/cop/gitlab/json.rb @@ -25,7 +25,7 @@ module RuboCop return unless method_name add_offense(node) do |corrector| - replacement = "Gitlab::Json.#{method_name}(#{arg_source})" + replacement = "#{cbased(node)}Gitlab::Json.#{method_name}(#{arg_source})" corrector.replace(node.source_range, replacement) end @@ -38,7 +38,7 @@ module RuboCop # Only match if the method is implemented by Gitlab::Json if method_name && AVAILABLE_METHODS.include?(method_name) - return [method_name, arg_nodes.map(&:source).join(', ')] + return [method_name, arg_nodes.map(&:source).join(", ")] end receiver = to_json_call?(node) @@ -46,6 +46,12 @@ module RuboCop nil end + + def cbased(node) + return unless %r{/ee/}.match?(node.location.expression.source_buffer.name) + + "::" + end end end end |