Skip to content

chore: improve code formatting support#127

Merged
pgj merged 4 commits intocloudant-labs:mainfrom
pgj:chore/code-formatting
Jan 22, 2026
Merged

chore: improve code formatting support#127
pgj merged 4 commits intocloudant-labs:mainfrom
pgj:chore/code-formatting

Conversation

@pgj
Copy link
Contributor

@pgj pgj commented Jan 17, 2026

Since the project uses a code format implemented by scalafmt, it might be useful to provide a dedicated make(1) target, scalafmt-format for developers to invoke the command. This is created in line with the existing erlfmt-format that works with Erlang sources.

While here, add an extra format-code target that calls both scalafmt-format and erlfmt-format for convenience. Also, extend the CI with calling the linters for running source code checks on the pull requests.

@pgj pgj force-pushed the chore/code-formatting branch from 9596e86 to c796ac9 Compare January 18, 2026 19:21
scalafmt-format:
@scalafmt --quiet

.PHONY: format-code
Copy link
Contributor

Choose a reason for hiding this comment

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

How about simplifying it to fmt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would not be consistent with other targets such as erlfmt-format and scalafmt-format so I think it is better keep it like that.

Copy link
Contributor

Choose a reason for hiding this comment

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

As we discussed at the meeting, it's up to you.

pgj added 2 commits January 21, 2026 17:50
Since the project uses a code format implemented by `scalafmt`, it
might be useful to provide a dedicated `make(1)` target,
`scalafmt-format` for developers to invoke the command.  This is
created in line with the existing `erlfmt-format` that works with
Erlang sources.

While here, add an extra `format-code` target that calls both
`scalafmt-format` and `erlfmt-format` for convenience.
So far we have not enforced the code formatting style via the CI,
but probably it is time to do.  Especially that we have a dedicated
`make(1)` target along with support for installing all the
appropriate tools.
@pgj pgj force-pushed the chore/code-formatting branch 2 times, most recently from 93cca1e to e91a374 Compare January 21, 2026 17:20
pgj added 2 commits January 21, 2026 19:57
The `ci-lint` target includes commands that pipe their output to a
log file but their failure will not stop `make(1)` because the
errors are not propagated in this case.  Fix this by enabling
`pipefail` for running of those.

As a consequence, the failed `make(1)` target might be then used
to halt the CI on code formatting problems.
@pgj pgj force-pushed the chore/code-formatting branch from 93cca1e to 5177339 Compare January 21, 2026 19:00
@pgj pgj merged commit 69910e4 into cloudant-labs:main Jan 22, 2026
1 check passed
@pgj pgj deleted the chore/code-formatting branch January 22, 2026 06:48
@pgj pgj mentioned this pull request Jan 22, 2026
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