prototool icon indicating copy to clipboard operation
prototool copied to clipboard

Build a "pluggable" lint rule

Open eleduardo opened this issue 6 years ago • 3 comments

The linting rules that the tool ships with are extremely powerful and very flexible. I have run into the need of adding a couple more rules but instead of contributing the rules themselves as features I was thinking if it would be better to provide a 'plugin' model where a set of pluggable modules can be added to the tool from the consumer side and via the configuration the tool just invokes those plugins.

If the team feels this could be a valuable contribution I could start working on it and send a PR where we could start the discussion.

For configuration something like this could work

lint: group: uber2 ignores: .... rules: ..... pluggable: - RULENAME

Any concerns with implementing something like this?

eleduardo avatar Aug 23 '19 19:08 eleduardo

I like this idea, but it is most likely a major change to allow a plugin model for rules, which I'd like to think through first. I'm up for discussion here though on how you see this working.

smaye81 avatar Sep 06 '19 02:09 smaye81

Would definitely be interested in something like this

artbegolli avatar Sep 26 '19 10:09 artbegolli

Sorry for the delay, in the following weeks and I can try a prototype so that we can discuss with code... My idea was to use the built in plugin support in go to create a linter rule that can load module based on configuration passed in the lint secion of the yaml file. In the config you could create an array of modules each pointing to the .so module and passing some common key value pairs... Each module just implements the same set of interfaces and structures that the regular linters do.

I can prototype this in the form a of PR and start the discussion from there.

eleduardo avatar Sep 26 '19 12:09 eleduardo