forked from rubocop/rubocop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug extend_self with private methods
This PR fixes rubocop#6370. Cop extend self to turn into module_function should not be invoked in case there are private methods. Because of that, the flow of the code gets broken. This is a very first draft PR. Once the code is good, I will proceed for the examples + documentation. There is one test scenario that I don't know how to make it. For declarative private methods like: ``` def test 'test' end private :test ``` the output for the node is: ``` s(:send, nil, :private, s(:sym, :test))) ``` Is there a way to do a `def_node_matcher` saying from the 3rd position (after private) I don't care about all the arguments that are there? Code reviews for a better code are more than welcome, since I am not an expert with the nodes system (maybe there's a better way to do my purpose) Looking forward to hearing from you, and hope we can manage the sceneario of declarative private methods best!
- Loading branch information
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters