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

New rule: Strict Module Layout #288

Open
elbrujohalcon opened this issue Mar 1, 2023 · 0 comments
Open

New rule: Strict Module Layout #288

elbrujohalcon opened this issue Mar 1, 2023 · 0 comments
Labels
Milestone

Comments

@elbrujohalcon
Copy link
Member

Strict Module Layout

Brief Description

Provide module parts in the required order.

-module(…).

-include[_lib](…).

-dialyzer(…).
-elvis(…).
-format #{…}.
-hank(…).
-mixin(…).
…

-type(…).
-type(…).
…

-export_type(…).

-export(…).

exported_function_1(…) ->exported_function_2(…) ->non_exported_function_1(…) –>

Should be on by default?

YES

Options

  • order :: [Part] when Part :: module | includes | types | … | everything_else (default: ??)

We need to come up with a list of all possible parts and a reasonable default for them. We can inspire ourselves in Credo (link below) but Erlang has some extra attribute types and we need to be able to correctly deal with -if, -ifdef, and all its friends.

Reasoning

Paraphrasing Credo documentation:

Like all Readability issues, this one is not a technical concern. But you can improve the odds of others reading and liking your code by making it easier to follow.

Origin (#281)

Inspired by the Consistency.Readability.StrictModuleLayout rule from Credo

@elbrujohalcon elbrujohalcon added this to the 3.1.0 milestone Mar 1, 2023
@paulo-ferraz-oliveira paulo-ferraz-oliveira changed the title Strict Module Layout New rule: Strict Module Layout Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant