Skip to content

Module name ending with a number is not correcty underscore-ed #10713

@fungalcofe

Description

@fungalcofe

Environment

  • Elixir & Erlang/OTP versions: Elixir 1.10.1 (compiled with Erlang/OTP 22)
  • Operating system: NixOS 20.09

Current behavior

I wrote a module named SHA512 (and related controller, view, etc.) in my Phoenix project and the view is searching templates under template/sh_a512.

This behaviour can also be noticed when using mix phx.gen.schema Something SHA512 sha512 lorem:string, generated files have many sh_a512 occurrences.

In iex this behaviour can be noticed by running the following:

iex(1)> Macro.underscore "SHA512"     
"sh_a512"
iex(2)> Macro.underscore "LOREMIPSUM512"
"loremipsu_m512"

Expected behavior

To have module's last letter looks unusual (sh_a512).
I'd expect to have the underscore placed between the letters and the numbers (sha_512) or no underscore split at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions