Skip to content
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

mute on defstruct and defdelegate #34

Open
dkuku opened this issue Feb 23, 2022 · 2 comments
Open

mute on defstruct and defdelegate #34

dkuku opened this issue Feb 23, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@dkuku
Copy link

dkuku commented Feb 23, 2022

Hi, something I spotted when trying to run on one of my toy projects:
I'm using gen_state_machine and depending on a module variant I pass to my machine it uses different logic.
mix_unused catches all my defstruct definitions and delegates as unused:

  defdelegate fetch(term, key), to: Map
  defdelegate get(term, key, default), to: Map
  defdelegate get_and_update(term, key, fun), to: Map
  defstruct @valid_moves
hint: %Score{} is unused
    lib/variants/score.ex:110

hint: Score.fetch/2 is unused
    lib/variants/score.ex:107

hint: Score.get/3 is unused
    lib/variants/score.ex:108

hint: Score.get_and_update/3 is unused
    lib/variants/score.ex:109

@hauleth
Copy link
Owner

hauleth commented Apr 27, 2022

Struct should be properly detected if it is used anywhere in the codebase, so simple %Score{} should be detected as usage of struct.

I can check if it is possible to extract the fact that it is defdelegate and then set it in metadata, so it should be then possible to filter using that on user end.

@hauleth hauleth added the enhancement New feature or request label Jun 15, 2023
@paulsabou
Copy link

defdelegate is often used in larger projects (which would benefit most from mix_unused). so would be really valuable to have defdelegate supported in a future version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants