Add special mode which would do reformat regardless of line width
iilyak opened this issue · 5 comments
We are evaluating erlfmt for CouchDB codebase here.
Currently erlfmt respects original formatting most of the time if the line fits the configured line width.
During initial conversion it would be useful to have a mode where erlfmt always reformat lines.
Here is how it could be used.
- use erlfmt to reformat all code
- commit
- use special erlfmt mode to force reformatting even if the line fits
- use
git add -p
to selectively commit chunks where it makes sense
I don't know if I understand.
currently erlfmt always reformats, even if the line fits.
When the line doesn't fit, is when the formatting differs more from the original, but it doesn't mean that when it fits, that it is not formatted.
Unfortunately the links didn't work, probably too big a diff for chrome to handle.
But I am going to guess and say maybe it has something to do with https://github.com/whatsapp/erlfmt#manual-interventions
How far am I off?
@iilyak I looked at the links, but I still do not understand. Maybe I will try again:
Here the #{}
is grabbed closer to the (
, since it is a single parameter.
?LOG_NOTICE(#{
...
}),
But here we have two parameters, so the parenthesis, do not grab.
?LOG_NOTICE(
#{
...
},
#{domain => [chttpd_access_log]}
),
Is this what you were asking about?
Thank you for the explanation of why we are seeing the difference. I'll close the issue. Feel free to re-open if you think there is any work or clarifications left.