Skip to content

Commit

Permalink
Revert "Update Cop::Style::ModuleFunction::FORBIDDEN_MSG to suggest…
Browse files Browse the repository at this point in the history
… to "Open the singleton class with `class << self` instead."."

This reverts commit e6a5da52e0e57158f6902e956c5675ba8198268f.
  • Loading branch information
RDeckard committed Oct 25, 2022
1 parent 05a7c59 commit 5f61a3b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion changelog/change_module_function-forbidden_msg.md

This file was deleted.

3 changes: 1 addition & 2 deletions lib/rubocop/cop/style/module_function.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ class ModuleFunction < Base

MODULE_FUNCTION_MSG = 'Use `module_function` instead of `extend self`.'
EXTEND_SELF_MSG = 'Use `extend self` instead of `module_function`.'
FORBIDDEN_MSG = 'Do not use `module_function` or `extend self`. ' \
'Open the singleton class with `class << self` instead.'
FORBIDDEN_MSG = 'Do not use `module_function` or `extend self`.'

# @!method module_function_node?(node)
def_node_matcher :module_function_node?, '(send nil? :module_function)'
Expand Down
8 changes: 4 additions & 4 deletions spec/rubocop/cop/style/module_function_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test; end
expect_offense(<<~RUBY)
module Test
extend self
^^^^^^^^^^^ Do not use `module_function` or `extend self`. Open the singleton class with `class << self` instead.
^^^^^^^^^^^ Do not use `module_function` or `extend self`.
def test; end
end
RUBY
Expand All @@ -101,7 +101,7 @@ def test; end
expect_offense(<<~RUBY)
module Test
extend self
^^^^^^^^^^^ Do not use `module_function` or `extend self`. Open the singleton class with `class << self` instead.
^^^^^^^^^^^ Do not use `module_function` or `extend self`.
def test; end
private
def test_private;end
Expand All @@ -115,7 +115,7 @@ def test_private;end
expect_offense(<<~RUBY)
module Test
extend self
^^^^^^^^^^^ Do not use `module_function` or `extend self`. Open the singleton class with `class << self` instead.
^^^^^^^^^^^ Do not use `module_function` or `extend self`.
def test; end
private :test
end
Expand All @@ -137,7 +137,7 @@ class Test
expect_offense(<<~RUBY)
module Test
module_function
^^^^^^^^^^^^^^^ Do not use `module_function` or `extend self`. Open the singleton class with `class << self` instead.
^^^^^^^^^^^^^^^ Do not use `module_function` or `extend self`.
def test; end
end
RUBY
Expand Down

0 comments on commit 5f61a3b

Please sign in to comment.