elixir-ecto / db_connection

Database connection behaviour
http://hexdocs.pm/db_connection/DBConnection.html
306 stars 113 forks source link

Mix format #232

Closed kianmeng closed 3 years ago

kianmeng commented 3 years ago

Since the minimum Elixir version is 1.7+, we should mix format the the whole module.

josevalim commented 3 years ago

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

josevalim commented 3 years ago

Thanks! I generally don't accept mix formatting PRs but all of the code formatted code here looked good without intervention, so :+1:.

kianmeng commented 3 years ago

Thanks! I generally don't accept mix formatting PRs but all of the code formatted code here looked good without intervention, so .

Noted. One question, for any legacy Elixir modules (created before Elixir 1.6), should we mix format it to update it to the latest code format or let it be?

wojtekmach commented 3 years ago

I believe running mix format on existing projects is not really about whether they're using Elixir v1.7+ but more about code churn. For example, we likely wouldn't accept a PR to Ecto that mix formats everything because:

a) there's a ton of code and we'd likely require a lot manual interventions b) it would mess up git history

kianmeng commented 3 years ago

I believe running mix format on existing projects is not really about whether they're using Elixir v1.7+ but more about code churn. For example, we likely wouldn't accept a PR to Ecto that mix formats everything because:

a) there's a ton of code and we'd likely require a lot manual interventions b) it would mess up git history

Noted and thanks for the explanation. If I encounter these type of legacy modules without code format, I will opt to raise a ticket instead and up to the module owner to mix format the whole repository or not.

michalmuskala commented 3 years ago

Git history can be dealt with using the relatively new --ignore-rev option to git blame to jump over the formatting commits.

There's a third reason, though, important for projects maintaining multiple versions, that back-porting fixes gets harder.