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

Credo.Check.Readability.FunctionNames potential false positives for non-sigil functions beginning with "sigil_" #1164

Open
brettbeatty opened this issue Nov 27, 2024 · 1 comment

Comments

@brettbeatty
Copy link

Environment

  • Credo version (mix credo -v):
    $ mix credo -v
    1.7.10-ref.nobranch.nocommit+uncommittedchanges
    
  • Erlang/Elixir version (elixir -v):
    $ elixir -v
    Erlang/OTP 27 [erts-15.1.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]
    
    Elixir 1.17.3 (compiled with Erlang/OTP 27)
    
  • Operating system: Ubuntu 24.04

What were you trying to do?

I have a sigil with a supporting private function. I prefixed the private function name with the sigil name, and when I updated credo it flagged it for not being in snake case.

Expected outcome

No errors

Actual outcome

┃ [R] ↗ Function/macro/guard names should be written in snake_case.
┃       lib/my_app.ex:6:8 #(MyApp.sigil_z_do)

It seems to happen with any function beginning with "sigil_" that is not in fact a sigil.

┃ [R] ↗ Function/macro/guard names should be written in snake_case.
┃       lib/my_app.ex:10:7 #(MyApp.sigil_do_something_else)

It seems a little odd to name a non-sigil function with a "sigil_" prefix, but as far as I'm aware there's nothing wrong with it.

Seems related to #1146

@rrrene
Copy link
Owner

rrrene commented Dec 13, 2024

Yeah, it seems like this issue and the referenced issue are at odds with each other 😰

Any suggestions how we could compromise here?

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

2 participants