Skip to content
代码片段 群组 项目
未验证 提交 e5161665 编辑于 作者: Martin Schurz's avatar Martin Schurz 提交者: GitLab
浏览文件

Move Cop/WithoutReactiveCache to gitlab-org/gitlab

Changelog: other
上级 6844cb93
No related branches found
No related tags found
无相关合并请求
......@@ -95,6 +95,11 @@ Cop/StaticTranslationDefinition:
- 'spec/**/*'
- 'ee/spec/**/*'
# Disable old cop, needs to be removed when gitlab-styles 13.0.0 is merged
# see: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/164582
Cop/WithoutReactiveCache:
Enabled: false
InternalAffairs/DeprecateCopHelper:
Enabled: true
Include:
......
# frozen_string_literal: true
module RuboCop
module Cop
module Gitlab
# Cop that prevents the use of `without_reactive_cache`
class WithoutReactiveCache < RuboCop::Cop::Base
MSG = 'without_reactive_cache is for debugging purposes only. Please use with_reactive_cache.'
RESTRICT_ON_SEND = %i[without_reactive_cache].freeze
def on_send(node)
add_offense(node.loc.selector)
end
end
end
end
end
# frozen_string_literal: true
require 'rubocop_spec_helper'
require_relative '../../../../rubocop/cop/gitlab/without_reactive_cache'
RSpec.describe RuboCop::Cop::Gitlab::WithoutReactiveCache, feature_category: :shared do
it 'registers an offense when without_reactive_cache is used' do
expect_offense(<<~RUBY)
without_reactive_cache do; end
^^^^^^^^^^^^^^^^^^^^^^ without_reactive_cache is for debugging purposes only. Please use with_reactive_cache.
RUBY
end
it 'does not flag unsupported methods' do
expect_no_offenses(<<~RUBY)
something_else do; end
RUBY
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册