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

comparison document between erlfmt and other erlang formatters #129

Merged
merged 9 commits into from
Sep 7, 2020

Conversation

awalterschulze
Copy link
Member

No description provided.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 3, 2020
@alanz
Copy link
Member

alanz commented Sep 4, 2020

Looks like a good highlight of the strengths of erlfmt

@awalterschulze awalterschulze marked this pull request as ready for review September 4, 2020 10:04
@awalterschulze awalterschulze changed the title first draft of comparison document comparison document between erlfmt and other erlang formatters Sep 4, 2020
README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@elbrujohalcon elbrujohalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some clarifications regarding rebar3_format.

At some point I think it would also be worth noting that wherever you mention rebar3_format in your text, you're actually referring to the default_formatter within rebar3_format. You can still use any other formatter with rebar3_format if you want to (including, of course, erlfmt).

doc/ErlangFormatterComparison.md Outdated Show resolved Hide resolved

## Macros

One of the biggest lacking features with current Erlang formatters in handling of macros. For example:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
One of the biggest lacking features with current Erlang formatters in handling of macros. For example:
One of the biggest lacking features with current Erlang formatters is the handling of macros. For example:


## Opt In/Out

`erlfmt` is the only Erlang formatter, as far as we know, that allows you to opt-in per file and opt-out per top-level expression.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebar3_format allows you to opt out from formatting, by adding -format ignore. in files, or by adding an ignore configuration option either in rebar.config or when running rebar3 format in the command line with a blob of the files you want not to format.
That applies regardless of the formatter you choose. If you happen to use erlfmt within rebar3_format, you can also use @format, of course.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some clarifications regarding rebar3_format.

At some point I think it would also be worth noting that wherever you mention rebar3_format in your text, you're actually referring to the default_formatter within rebar3_format. You can still use any other formatter with rebar3_format if you want to (including, of course, erlfmt).

Very good point. I have added a clarifying sentence to the top, right below the table.

@elbrujohalcon
Copy link
Contributor

HA! That's synchronicity :P

@awalterschulze
Copy link
Member Author

@elbrujohalcon I think I have addressed your comments. Let me know if I missed something, because this would be unintentional.

@ilya-klyuchnikov
Copy link
Member

ilya-klyuchnikov commented Sep 4, 2020

My understanding is that no formatters so far are capable of formatting yrl files. (And as a guy working on yrl files a lot lately - I would like to bring this fact to the table). - I don't see any mentioning of yrl files in this comparison.

@awalterschulze
Copy link
Member Author

My understanding is that no formatters so far are capable of formatting yrl files. (And as a guy working on yrl files a lot lately - I would like to bring this fact to the table). - I don't see any mentioning of yrl files in this comparison.

We are aware :)
#41
You might also notice the extra spaces that are left in the table specifically so that it is easy to .yrl and .xrl extensions.

Copy link
Contributor

@elbrujohalcon elbrujohalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @awalterschulze 🙏

|Opt In/Out |per file, per top level expression |per file |No |No |
|Speed |OTP lib in 7s |N/A |N/A |N/A |

See the [comparison with other erlang formatters document](./doc/ErlangFormatterComparison.md) for more details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move this section a bit below, especially below install/usage instructions. What do you think?

Perhaps we need a small ToC at the beginning of the readme?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the references as close as possible to the content, but a TBC is a great idea.
I'll add one in a following pull request.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request for TBC #132

Copy link
Member

@michalmuskala michalmuskala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is generally good to go

@awalterschulze awalterschulze merged commit 57995e4 into master Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants