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/base.rb')
-rw-r--r--rubocop/cop/api/base.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/rubocop/cop/api/base.rb b/rubocop/cop/api/base.rb
index 85b19e9a833..c10115c8265 100644
--- a/rubocop/cop/api/base.rb
+++ b/rubocop/cop/api/base.rb
@@ -3,7 +3,9 @@
module RuboCop
module Cop
module API
- class Base < RuboCop::Cop::Cop
+ class Base < RuboCop::Cop::Base
+ extend RuboCop::Cop::AutoCorrector
+
# This cop checks that APIs subclass API::Base.
#
# @example
@@ -38,13 +40,9 @@ module RuboCop
def on_class(node)
grape_api_definition(node) do
- add_offense(node.children[1])
- end
- end
-
- def autocorrect(node)
- lambda do |corrector|
- corrector.replace(node, '::API::Base')
+ add_offense(node.children[1]) do |corrector|
+ corrector.replace(node.children[1], '::API::Base')
+ end
end
end
end