elixirfmt - questions

53 views
Skip to first unread message

robin...@hotmail.com

unread,
Feb 21, 2017, 6:07:43 PM2/21/17
to BEAM Community, an.le...@gmail.com
Hi!

I'm interested in the elixirfmt proposal. I have some assumptions and questions, and would like to get some input on it :)

Assumption
The formatter will use one and enforce one standard style guide. It will take the AST representation of the source code and transform the AST according to the style guide.

Idea
Elixir already exposes the AST and has convenient functions in the Code module. My initial idea is something like this:

 - A set of rules for each token and its representation (related to the style guide)

 - Recursively traverse the project directory and evaluate every .ex file.

 - Evaluate the AST and transform each token according to the style guide.

As I see it, each token can be a subtree and if so recurse down to the leaves and transform from the bottom and up.

Questions
1. Is the thought that this will be included with mix?
2. Will it be possible to configure this style guide through configurations files?

If you have any recommendations for improvements or criticism, please comment I would love to hear your thoughts :)

Best regards,
Robin.

José Valim

unread,
Feb 21, 2017, 6:38:05 PM2/21/17
to Robin Saleh-Jan, BEAM Community, Andrea Leopardi
Your assumptions are correct. While integration with Mix and configuration may be necessary, I wouldn't worry about them at this stage. The important for now is the ability to receive a file, format it, and save it back to disk.


José Valim
Skype: jv.ptec
Founder and Director of R&D
Reply all
Reply to author
Forward
0 new messages