-
Notifications
You must be signed in to change notification settings - Fork 286
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
Allow revive to be called with extra linters #650
Conversation
This change allows revive to be called from main.go in other libraries and pass in a list of custom linters to be added to the built-in linters found in config
Can confirm that using my fork I already set up revive with additional linters in our repo. It is working great :D That way I can build and distribute internal versions of our linter to every eng in the company (using brew probably). Thanks once again for such a great tool! |
Hi @heynemann thanks for the PR. Great idea! I'll check it this we. |
- reorganizes code for better reading
@heynemann, I did a small refactoring in the If you are Ok with the refactoring, I'll go on with the merge. |
Definitely ok with me :) Already using this PR to write new rules and it is a bliss :) |
Thank you very much for merging this. Is there any rule about being in the readme as a contributor? |
Just modify the README.md |
This change allows revive to be called from other libraries and pass in a list of custom linters to be added to the built-in linters found in config.
After this change, users who want to extend Revive can do it without forking. It's a simple matter of creating a new folder with
main.go
:Then in their .toml file:
As soon as they remove [rule.custom-rule] from their config, it is not run (even though it is passed as an extra rule.
The motivation for this PR is that I intend to base the custom linters for my company on revive and do not wish to maintain a fork of it. It feels much safer to just use a function that does everything and receives the extra rules as arguments.
The change in revive's codebase is so small that it felt like a good way moving forward to enable even easier extensibility for this amazing project.
If you feel like this is a valuable contribution I'm more than happy to add tests and update the docs on how to create and use custom rules without forking.