Skip to content

Conversation

badlop
Copy link
Member

@badlop badlop commented Sep 3, 2025

ejabberd 24.06 introduced experimental support for make format using Rebar3 + rebar3_format and support for make indent using Emacs + erlang-mode. Both of them are optional, and applied in small portions of the ejabberd source code.

The corresponding documentation was added to the Docs site, including an explanation to format automatically when running git push

Unfortunately rebar3_format is now marked as "archived", so it is time to look for an active replacement.

Nowadays I have found two erlang source code formatters:

  • Silo's efmt, which looks quite close to the existing formatting
  • WhatsApp' erlfmt, more popular, but the resulting format is quite different to what we are used

In some cases that none of them achieves an acceptable formatting, we can use emacs indentation.

This PR:

  • setups make format to use efmt
  • then prepares some existing code to ensure it will get properly formatted or indented
  • it formats and indent all the ejabberd source code base (we can consider this a cosmetic commit)
  • and finally adds that cosmetic commit in a "git blame ignore file"

Right now this is a proposal. Please comment alternatives, ideas, problems that you found...

@weiss
Copy link
Member

weiss commented Sep 3, 2025

and finally adds that cosmetic commit in a "git blame ignore file"

Sounds good.

Personally I'd still be worried about how that might affect other tools. E.g., when I'm wondering what a specific $line of code is supposed to do, I often consult git log -S"$line". For several years, that query kept returning commit 9deb294

@nosnilmot
Copy link
Contributor

I suggest mentioning in the commit message for the "Result of running "make format indent" for the first time" commit how to ignore it:

# These changes can be ignored by `git blame` using:
#   git blame --ignore-revs-file .git-blame-ignore-revs`
# Or configure git to use always this file:
#   git config blame.ignoreRevsFile .git-blame-ignore-revs

(I realise that technically it is not possible at that point because that file is only added in the next commit, but this is the one that will be seen)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants