We'd need to go deeper with the logic here than just checking for literally "duplicated" alias calls, as aliases can impact later ones—for a contrived example, see:
``` defmodule Na.Na.Na.Na.Na.Na.Batman do def batman!, do: :batman end defmodule Test do alias Na.Na alias Na.Na alias Na.Na alias Na.Na import Na.Batman batman!() batman!() batman!() end ``` On Monday, September 11, 2023 at 7:40:48 PM UTC-5 vinig...@gmail.com wrote: > Would it be possible for us to warn when an user declares duplicated > aliases in the same scope? > > This code, for example: > > ``` > defmodule Test do > alias IO.ANSI > alias IO.ANSI > alias IO.ANSI > > def hello do > IO.puts([ANSI.red(), "hey", ANSI.reset()]) > end > end > ``` > > Compiles without any warnings, even though two of these aliases are just > "dead code". > > I've noticed this after seeing some codebases containing files with these > duplicated aliases, something that can actually happening sometimes when > people solve conflicts and don't review it thoroughly. > > Also credo currently does not catch that and I believe a proposal there > would also be fine, but I'm not sure why the language couldn't warn in such > cases, since this is more like dead code than styling/linting. > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/547943a0-f4db-4df2-8357-1d9b324d2f12n%40googlegroups.com.