-
Notifications
You must be signed in to change notification settings - Fork 56
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
change(export_used_types): don't warn on behaviour callbacks #371
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this fix.
This will still fail on the following scenarios:
- On
gen_statem
,ct_suite
, and other behaviours with dynamic callbacks, until Can we add a way to specify dynamic callbacks? erlang/otp#4847 is taken care of. - On custom behaviours, defined by the user in the same app that we're analyzing.
I'm not rejecting the PR entirely, but I'll leave it in the hands of @paulo-ferraz-oliveira to decide if this improving is worth merging or not.
lists:map(fun(#{attrs := #{value := Behaviour}}) -> Behaviour end, Behaviours), | ||
|
||
lists:append( | ||
lists:map(fun(B) -> apply(B, behaviour_info, [callbacks]) end, BehaviourNames)). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A try…catch
is needed here, just in case someone introduces a typo (-behaviour(gen_srvr).
) or uses a behaviour that's defined outside of OTP (-behaviour(my_behaviour).
).
You are absolutely right. It was my best shot to solve this issue, until the issue erlang/otp#4847 will be solved. I'm curious what do you think about it, or do you think that we should wait for the mentioned otp change request to be solved? |
I think we should wait… but let's hear what @paulo-ferraz-oliveira has to say. |
Description
I implemented a way to get the callbacks for the behaviors in the module and subtract them from the function used in the rule's logic. This approach ensures that all callback types are ignored.
Additionally, there was a test that expected a warning from a module that no longer generates one. So, I removed that assertion, but I'm not sure if that was the correct decision.
Closes #308.