Skip to content

Commit 481928e

Browse files
corrodedchristopheradams
authored andcommitted
Add repeating module name rule
1 parent 57171df commit 481928e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,24 @@ Translations of the guide are available in the following languages:
817817
end
818818
```
819819

820+
* <a name="repetitive-module-names"></a>
821+
Avoid repeating fragments in module names and namespaces.
822+
This improves overall readability and
823+
eliminates [ambiguous aliases][Conflicting Aliases].
824+
<sup>[[link](#repetitive-module-names)]</sup>
825+
826+
```elixir
827+
# not preferred
828+
defmodule Todo.Todo do
829+
...
830+
end
831+
832+
# preferred
833+
defmodule Todo.Item do
834+
...
835+
end
836+
```
837+
820838
### Documentation
821839

822840
Documentation in Elixir (when read either in `iex` with `h` or generated with
@@ -1167,6 +1185,7 @@ project.
11671185
[Chinese Traditional]: https://github.com/elixirtw/elixir_style_guide/blob/master/README_zhTW.md
11681186
[Code Analysis]: https://github.com/h4cc/awesome-elixir#code-analysis
11691187
[Code Of Conduct]: https://github.com/christopheradams/elixir_style_guide/blob/master/CODE_OF_CONDUCT.md
1188+
[Conflicting Aliases]: https://elixirforum.com/t/using-aliases-for-fubar-fubar-named-module/1723
11701189
[Contributing]: https://github.com/elixir-lang/elixir/blob/master/CODE_OF_CONDUCT.md
11711190
[Contributors]: https://github.com/christopheradams/elixir_style_guide/graphs/contributors
11721191
[Elixir Style Guide]: https://github.com/christopheradams/elixir_style_guide

0 commit comments

Comments
 (0)