Skip to content

Commit

Permalink
Rename method definition cop to reflect fixed behaviour
Browse files Browse the repository at this point in the history
Since the cop is now fixed to warn against method in namespaces, update
the cop name accordingly.
  • Loading branch information
Thong Kuah committed Nov 11, 2023
1 parent 39c1bb0 commit 2915482
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Rake/DuplicateTask:
Enabled: true
VersionAdded: '0.4.0'

Rake/MethodDefinitionInTask:
Description: 'Do not define a method in rake task, because it will be defined to the top level.'
Rake/MethodDefinitionInNamespace:
Description: 'Do not define a method in a rake namespace, because it will be defined to the top level.'
Enabled: true
VersionAdded: '0.2.0'
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module Rake
# task :foo do
# end
#
class MethodDefinitionInTask < Base
class MethodDefinitionInNamespace < Base
MSG = 'Do not define a method in a rake namespace, because it will be defined to the top level.'

def on_def(node)
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rake_cops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
require_relative 'rake/desc'
require_relative 'rake/duplicate_task'
require_relative 'rake/duplicate_namespace'
require_relative 'rake/method_definition_in_task'
require_relative 'rake/method_definition_in_namespace'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Rake::MethodDefinitionInTask, :config do
RSpec.describe RuboCop::Cop::Rake::MethodDefinitionInNamespace, :config do
it 'does not register an offense to `def` in a task' do
expect_no_offenses(<<~RUBY)
task :foo do
Expand Down

0 comments on commit 2915482

Please sign in to comment.