Add LinterTrait, which provides the common functions for both SingleRuleLinter and HHClientLinter
This feels like it should be an abstract class instead: every linter should use this trait and implement the interface.
We can turn this trait into an abstract class for now. But it would become a problem if we also create another abstract class for LintRule, because SingleRuleLinter cannot extend both abstract classes.
Yeah :( I suspect we'll revisit this once traits are reworked and formalize. We might end up doing base classes and traits - base classes for devx, where the base classes always pull in the traits - but as multiple inheritance isn't supported, SingleRuleLinter would have to use at least one of the traits directly
Yeah :( I suspect we'll revisit this once traits are reworked and formalize. We might end up doing base classes and traits - base classes for devx, where the base classes always pull in the traits - but as multiple inheritance isn't supported, SingleRuleLinter would have to use at least one of the traits directly
By the way, I updated this PR to introduce the BaseLinter as an abstract class, but I feel we could have a better design than this.
I think the best design in Hack, considering the restrictions in the object model, is to minimize the interfaces and to eliminate the demand of sharing implementation between class instances. We can then move helper methods into namespaces as top-level free functions. Each time we want to add a helper, we add it as a free function. Each time we need new methods in the interfaces, we create a new interface containing the new methods instead of changing existing interfaces.
Each time we need new methods in the interfaces, we create a new interface containing the new methods instead of changing existing interfaces.
If there's a semantic separation, i agree with this, but not purely as a BC mechanism; large sets of related hierarchies really hurt developer experience. BC vs devx is a tradeoff.
Hi @Atry!
Thank you for your pull request.
We require contributors to sign our Contributor License Agreement, and yours needs attention.
You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.
Process
In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.
Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.
If you have received this in error or have any questions, please contact us at [email protected]. Thanks!