Skip to content

Create something like RuboCop's node matcher macros #1288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mvz opened this issue Jan 5, 2018 · 6 comments
Open

Create something like RuboCop's node matcher macros #1288

mvz opened this issue Jan 5, 2018 · 6 comments

Comments

@mvz
Copy link
Collaborator

mvz commented Jan 5, 2018

As an experiment, I implemented part of NilCheck using the RuboCop system. I found the node patterns and matcher macros very nice and useful.

More information here: https://github.com/bbatsov/rubocop/blob/f5fed30d4106c8aff7dd27ffef947def530deae1/manual/node_pattern.md

@Drenmi
Copy link
Contributor

Drenmi commented Jan 5, 2018

They are tremendously useful. 🙂

There are some pending features for the node matchers, for example optional fragments, that currently no-one is working on. If @bbatsov is up for it, perhaps it can be extracted into a separate gem, and contributions can be made from more directions. WDYT?

@pocke
Copy link
Collaborator

pocke commented Jan 7, 2018

Yes, I would like to extract it into a separate gem. And I tried to extract it, but it has been stopped because I was very busy. https://github.com/pocke/node_pattern
It rewrites node pattern with kpeg for readability. pocke/node_pattern#1

@bbatsov
Copy link

bbatsov commented Jan 7, 2018

I'm not opposed to the idea. A lot of things can be extracted from RuboCop, but I simply never got to doing so. Much of the AST node extensions are also something that'd be useful to anyone using underlying ast gem. Probably at some point we can move RuboCop to some organization and place there some related projects.

@pocke Cool!

@mvz
Copy link
Collaborator Author

mvz commented Jan 8, 2018

Having this extracted to a separate gem would be great for us. @pocke do you think your attempt can be continued or is it too outdated?

@bbatsov
Copy link

bbatsov commented Jan 8, 2018

I see it's just 21 days old. I would hardly call this outdated. 😄

@mvz
Copy link
Collaborator Author

mvz commented Jan 8, 2018

Oh wow, I wouldn't have guessed. My timeframe for concluding 'stopped because too busy' is a bit longer than @pocke's, it seems 😆.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants