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
RuboCop plugins/extensions API #6012
Comments
I've just invited you to RuboCop HQ, so you can transfer the gem at your convenience.
Yeah, I completely agree. This should be an easy change.
Agree with you here as well. I seem to recall you owe me a few PRs, so you might start by tackling this. ;-) |
Sure. I'll start right after Paris.rb) |
Done! |
Is the current implementation and the use of RuboCop's internal API as done in Are there plans to enhance the documentation with how to create a plugin? I wasn't able to find anything related. Just asking for the "best practices" 😀 Are there any other RuboCop plugins available where I can look at? 🤔 Edit: Oh I found some
🎉 |
There is no official plugin architecture right now unfortunately. The solutions some of the extension libraries have used (such as the A small amount of configuration has been moved to be more extensible by extensions, but there is much more that works now by hacks. https://docs.rubocop.org/rubocop/extensions.html is probably the best "documentation" right now but it's pretty sparse. |
@dvandersluis Thanks for the fast and insightful response ❤️ I mixed up extensions with plugins - actually I thought these were two different concepts - they aren't 👍 https://github.com/rubocop/rubocop-extension-generator is a great starting point 🎉 |
Some thoughts on plugins/extensions API after writing a
rubocop-md
gem (btw, @bbatsov I'd like to transfer this gem torubocop-hq
if you don't mind).Ability to customize supported file extensions listSolved by Ability to specify files/directories to look at and ignore everything else #4247Ability to extend the default configuration.
When inheriting from default, the plugin's default configuration should be merged into it.
Right now we have to monkey-patch (see, for example, rubocop-rspec).
Related method is
ConfigLoader#default_configuration
:Suppose that we have a list of plugins. The the method could look like this:
More specific features (but it would be great to have a way to do that without monkey-patching):
Ability to modify the source before parsing it (example).
It's a way to generate a Ruby-parseable contents from non-Ruby files.
Ideally, it would be great to make it possible to inject between any two steps in the process:
These features are mostly useful to use RuboCop with non-Ruby files; there are some existing projects, such as https://github.com/ericqweinstein/ruumba, https://github.com/brigade/haml-lint.
We can introduce a plugin interface like this:
The text was updated successfully, but these errors were encountered: