-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: Support external rulesets #6083
base: master
Are you sure you want to change the base?
feat: Support external rulesets #6083
Conversation
Thanks for all your work on this idea! I've not time now to look into some more right now, however I think #5802 is aiming for something similar so cross referencing it here |
I tried to search for implementations for this and failed to find it. On my own comparison now I see that the other PR changes logic further than mine. Creating a factory (which I would rather call a repository) for these is not needed in my opinion, but it's a nice idea if we want to start serving RuleSets from different places (databases, different formats). To me my way of naming the RuleSets is easier to understand, but this is matter of taste, too. If you decide this is a way to go, I'm happy to improve documentation for this prior to merge. I will not change this further until receiving comments. |
@SpacePossum, as discussed in another PR, for this to be really usable the Another question would be if you'd prefer |
Really looking forward to this for Drupal to make it usable like for phpcs (--standard=DrupalPractice) or phpcbf! (--standard=Drupal) |
|
Thank you @SpacePossum! Sorry, I know. Perhaps I didn't choose the right words. I just wanted to point out that there are similar funtionalities for phpcs and phpcbf and that page documenteds, how to set the standards for these tools Drupal-specific. I'd be happy if one day php-cs-fixer could appear there and could work like that. Sorry for the misunderstanding. Once this is finished, I'll document it over there for the Drupal Community. |
Ah sorry about that, all good :D Thanks for looking out for this feature and the tool itself! |
This would be exactly what I was looking for. Any idea if and when this would be added? I was kind of surprised that this was not yet possible so I think your PR is spot on. Great work 👍 |
Author here. I think that after @SpacePossum and others have decided if the approach taken to tackle the issue is what should be done, I still need to write proper documentation for the feature. It should be noted that this is a breaking change as this changes a public interface |
@SpacePossum what should we do to get this moving to one direction or other? 🙂 |
Anything I can do to get this forward? I would need the feature myself. 😄 |
cf05ddb
to
1433083
Compare
I'll put this on the list to discuss within the team in a google call (likely early next week), hope we come to a plan to more forward, thanks for understanding :) |
Thanks for the update! 🙂 |
This comment was marked as outdated.
This comment was marked as outdated.
@niklam is it possible to rebase this PR, so we can check current pipeline result and continue the review process? |
Sure 👍 |
1433083
to
d71c931
Compare
Hmmm, needs some tweak here and there 😅. |
Yes 😅 A lot has happened between my PR and now. Should be good now! |
This allows to do the same sorting across multiple places where it's needed, currently ::getSetDefinitions() and ::registerRuleSet().
Co-authored-by: Greg Korba <wirone@gmail.com>
Co-authored-by: Kuba Werłos <werlos@gmail.com>
Co-authored-by: Greg Korba <wirone@gmail.com>
- cover built-in rule sets - cover risky convention
It does not make sense to pass name explicitly during registration, because ruleset should identify itself using contract (`RuleSetDescriptionInterface::getName()`).
780c403
to
81c7a5a
Compare
@keradus I've reworked how custom rules sets' registration is handled, also added TODO section to PR's description with links to ongoing discussions that have to be resolved. It would be great if we can continue this, because I see it as the next most important improvement after parallel runner 🙂. |
Supporting external rule sets makes it easier to share rule sets across different projects. In many cases a single product is spread across multiple repositories, so this is important.
Registering a RuleSet is done with
ConfigInterface::registerRuleSet(array $ruleSets)
.Actual rule set addition is done in
RuleSets
, where rule set name and class are validated against certain rules:RuleSetDescriptionInterface
Sample usage:
Note
This is not a breaking change as
ConfigInterface
is not changed while this introduces a new method toConfig
. The new method should be added to the interface in version 4.0.TODO