-
Notifications
You must be signed in to change notification settings - Fork 87
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
Dynamic Functions #17
Comments
[Closes #17] Implemented invalid dynamic calls rule.
[Closes #17] Implemented 'used ignored variable' rule.
On one hand great rule. We found with it few places we could improve our code with it. On other we have some issues with this one. Especially with making it go away. This one assumes that all callback have to be defined in module that uses them. And this is not always our case. Personally I prefer to create separate module that just have callback. Like this one. This is especially useful when more than one module uses same kind of behaviour. Second use case is when one module uses two types of behaviors. For example we could have generic algorithm that handles interactions of cats and dogs. So you could have both calls like Our solution (not to pass Elvis rule, but rather to keep code clean/readable) would be specs. To be exact we define and export type from callback module, like So maybe some modification of this rule would be a good idea ? |
There is a third option: We define callback module, with functions calling callbacks: And all the clients call callback-module which calls callbacks implementations. Not sure if you had in mind such pattern when you designed this rule, but this is good for both to Elvis rule, and our use case problems. And i think I like it, even little more than dynamic calls. Huge kudos to @pianiel for coming up with such solution. |
@mpmiszczyk I understand your two scenarios and, to cope with things like that is why we added a list of module exceptions to the rule. Because we couldn't find a different way to be sure that a call to |
Rule
Options
The text was updated successfully, but these errors were encountered: