Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Rubocop custom cop nodepattern class method regardless class/modules

I would like to catch all the bar class methods regardless its class/module.

I can catch Foo.bar with (send (const nil? :Foo) :bar) but i would like to catch Woohoo::Foo.bar or even Woohoo::Foo.bar(some_attr: some_value).

I basically want to say .bar method is deprecated use some_new_method instead.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Is there a way to do it?

Thanks to you all!

>Solution :

Yes, instead of forcing the constant’s scope to be nil?, you can accept any scope with

(send (const _ :Foo) :bar)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading