From 43cf85b3a3e1d3c51f27480d037bec56e67f861c Mon Sep 17 00:00:00 2001 From: Eumir Gaspar Date: Thu, 9 Mar 2017 00:07:26 +0800 Subject: [PATCH 1/2] Added avoid repeating module name rule --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 0eb1ed2..8b20a7b 100644 --- a/README.md +++ b/README.md @@ -774,6 +774,24 @@ Translations of the guide are available in the following languages: end ``` +* + Avoid repeating fragments in module names and namespaces. + This improves overall readability and + eliminates [ambiguous aliases][Conflicting Aliases]. + [[link](#avoid-repeating-aliased-module-fragments)] + + ```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 @@ -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 From 34388e80f90b37b0e941da6570f2db81b63a41de Mon Sep 17 00:00:00 2001 From: Christopher Adams Date: Thu, 9 Mar 2017 17:38:32 +0800 Subject: [PATCH 2/2] shorten anchor --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8b20a7b..9144bbc 100644 --- a/README.md +++ b/README.md @@ -774,11 +774,11 @@ Translations of the guide are available in the following languages: end ``` -* +* Avoid repeating fragments in module names and namespaces. This improves overall readability and eliminates [ambiguous aliases][Conflicting Aliases]. - [[link](#avoid-repeating-aliased-module-fragments)] + [[link](#repetitive-module-names)] ```elixir # not preferred