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

Added avoid repeating module name rule #136

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,24 @@ Translations of the guide are available in the following languages:
end
```

* <a name="repetitive-module-names"></a>
Avoid repeating fragments in module names and namespaces.
This improves overall readability and
eliminates [ambiguous aliases][Conflicting Aliases].
<sup>[[link](#repetitive-module-names)]</sup>

```elixir
# not preferred
defmodule Todo.Todo do
...
end

# preferred
defmodule Todo.Item do
...
end
```

### Documentation

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