This PR does multiple clang-format related things:
It revamps tools/formatter.sh.
It fixes and re-enables the clang-format workflow.
It makes sure that all files obey the style settings in .clang-format.
Related Issues
Closes #450.
Checklist
[x] I have tested my changes locally and verified that they work as intended.
[ ] I have documented any new or modified functionality.
[x] I have reviewed the changes to ensure they do not introduce any unnecessary complexity or duplicate code.
[x] I understand that by submitting this pull request, I am agreeing to license my contributions under the project's license.
Additional Comments
This PR is meant to be an alternative to #450. Here are the differences between this PR and that other PR.
The script that this PR introduces is much shorter than the two scripts that other PR introduces.
The script that this PR introduces has less dependencies that the shell script that the other PR introduces. This PR’s script depends on /bin/sh, git and clang-format. The other PR’s shell script depends on /bin/sh, which, clang-format, xargs/parallel and find.
The script that this PR introduces doesn’t bother checking whether or not its dependencies are present before trying to execute them. The shell script that the other PR introduces checks for its dependencies before trying to execute them. As far as I know, there’s no real consequences if this PR’s script gets run by someone who doesn’t have git or clang-format, so checking to see if they’re available is not necessary.
This PR introduce a single shell script. The other PR introduces a shell script and a batch script. Windows users can just run the shell script in Git Bash. After all, building Descent 3 already depends on Git, and Git depends on “A POSIX-compliant shell”.
[!IMPORTANT]
I’m not so sure that this PR should actually be merged. I have a concern that I wrote about here. Depending on how we decide to resolve that concern, I might end up canceling this PR.
Pull Request Type
Description
This PR does multiple
clang-format
related things:It revamps
tools/formatter.sh
.It fixes and re-enables the
clang-format
workflow.It makes sure that all files obey the style settings in
.clang-format
.Related Issues
Closes #450.
Checklist
Additional Comments
This PR is meant to be an alternative to #450. Here are the differences between this PR and that other PR.
/bin/sh
,git
andclang-format
. The other PR’s shell script depends on/bin/sh
,which
,clang-format
,xargs
/parallel
andfind
.which
. The shell script that the other PR introduces depends on a version ofwhich
that support the-s
flag. GNUwhich
does not support the-s
flag.. I don’t know how common GNUwhich
is compared to other implementations ofwhich
, but I do know that GNUwhich
is a required package on NixOS and a mandatory package on Fedora Workstation.git
orclang-format
, so checking to see if they’re available is not necessary.