Skip to content

Commit

Permalink
Add repeating module name rule
Browse files Browse the repository at this point in the history
  • Loading branch information
corroded authored and christopheradams committed Mar 9, 2017
1 parent 57171df commit 481928e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,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 @@ -1167,6 +1185,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

0 comments on commit 481928e

Please sign in to comment.