Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'rubocop/cop/api/grape_api_instance.rb')
-rw-r--r--rubocop/cop/api/grape_api_instance.rb42
1 files changed, 0 insertions, 42 deletions
diff --git a/rubocop/cop/api/grape_api_instance.rb b/rubocop/cop/api/grape_api_instance.rb
deleted file mode 100644
index de11b9ef3f6..00000000000
--- a/rubocop/cop/api/grape_api_instance.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-# frozen_string_literal: true
-
-module RuboCop
- module Cop
- module API
- class GrapeAPIInstance < RuboCop::Cop::Cop
- # This cop checks that APIs subclass Grape::API::Instance with Grape v1.3+.
- #
- # @example
- #
- # # bad
- # module API
- # class Projects < Grape::API
- # end
- # end
- #
- # # good
- # module API
- # class Projects < Grape::API::Instance
- # end
- # end
- MSG = 'Inherit from Grape::API::Instance instead of Grape::API. ' \
- 'For more details check the https://gitlab.com/gitlab-org/gitlab/-/issues/215230.'
-
- def_node_matcher :grape_api_definition, <<~PATTERN
- (class
- (const _ _)
- (const
- (const nil? :Grape) :API)
- ...
- )
- PATTERN
-
- def on_class(node)
- grape_api_definition(node) do
- add_offense(node.children[1])
- end
- end
- end
- end
- end
-end