Skip to content
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

Forces that could run along with cops #8420

Closed
marcandre opened this issue Jul 30, 2020 · 1 comment
Closed

Forces that could run along with cops #8420

marcandre opened this issue Jul 30, 2020 · 1 comment

Comments

@marcandre
Copy link
Contributor

We are starting to have cops using the Regexp parser (like #8407).

I'd like to factorize that parsing.

It could be done in a shared module, maybe with a global registry of regexp to avoid parsing the same regexp many times, but I was thinking that another way would be a ParsedRegexp force that would do the parsing and call on_parsed_regexp for those cops that want to use it (2 right now). This would require that Forces to be allowed to respond to the same callbacks than cops at the same time though (so that on_parsed_regexp from the force and on_nth_ref from Commissionner are fired in the right alternance).

We have currently only a single Force in the builtin gem (VariableForce). It does it's own processing and wouldn't be affected as it uses process_rescue and not on_rescue. Other forces might. Are there other known examples? Is it worth keeping compatibility by defining a different Force::Base?

@marcandre
Copy link
Contributor Author

Closing in favor of #8510

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

No branches or pull requests

1 participant