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

Do not emit warnings for underscored arguments #29

Open
florius0 opened this issue Sep 10, 2023 · 4 comments
Open

Do not emit warnings for underscored arguments #29

florius0 opened this issue Sep 10, 2023 · 4 comments
Assignees

Comments

@florius0
Copy link
Contributor

When using @decorate trace(), warnings for underscored arguments are emitted, however these arguments are not being used in the function itself:

# ...
  @decorate trace()
  def index(conn, _params) do
    small_fish = find_fish()
    large_fish = find_fish("large")

    json(conn, small_fish ++ large_fish)
  end
# ...

Will result in warning: the underscored variable "_params" is used after being set. A leading underscore indicates that the value of the variable should be ignored. If this is intended please rename the variable to remove the underscore

Probably can be fixed with generated: true in quotes

@vereis
Copy link
Collaborator

vereis commented Sep 11, 2023

This is actually a limitation in the decorator library we're using I believe 😞

We're actually working on an experimental replacement for the decorator library which won't emit these warnings.

Another limitation is that you may need to add unnecessary function heads to set default arguments at times.

Will continue working on this and keep you posted!

@vereis
Copy link
Collaborator

vereis commented Jan 22, 2024

Ahoy all! I've just pushed a PR containing a new Sibyl.Experimental module which should give us the ability to trace functions without needed to run into the pitfalls of the decorator library we're currently using.

Usage should generally be similar:

use Sibyl.Experimental

@sibyl trace: true
def my_function do
  :ok
end

Or

use Sibyl.Experimental, trace_all: true

Any thoughts would be much appreciated: #35!

@APB9785
Copy link

APB9785 commented Apr 15, 2024

I see this was supposedly solved here: #23
Why are we still seeing the issue here?

Note: I am on the latest Sibyl and experiencing major issue compiling functions with unused argument

@APB9785
Copy link

APB9785 commented Apr 15, 2024

EDIT: the issue was actually caused by Sibyl not getting updated properly, it was conflicting with opentelemetry_process_propagator and ended up running an old version from before that PR was released. With a manual conflict resolution, I was able to get Sibyl on the latest update for real, and the issue is resolved. 🙂

for anyone else with the same issue:

  • mix deps.unlock sibyl
  • mix deps.unlock opentelemetry_process_propagator
  • set {:sibyl, "~> 0.1.9"} in mix.exs
  • mix deps.get

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

No branches or pull requests

3 participants