]> git.sesse.net Git - stockfish/commit
add clang-format
authorDisservin <disservin.social@gmail.com>
Sat, 21 Oct 2023 09:40:56 +0000 (11:40 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sun, 22 Oct 2023 14:06:27 +0000 (16:06 +0200)
commit2d0237db3f0e596fb06e3ffbadba84dcc4e018f6
tree1a892ab4ec317ee0c57256724b08cf7dd30dc75c
parent8366ec48ae6fc57dffad849b20844d5b07f963b4
add clang-format

This introduces clang-format to enforce a consistent code style for Stockfish.

Having a documented and consistent style across the code will make contributing easier
for new developers, and will make larger changes to the codebase easier to make.

To facilitate formatting, this PR includes a Makefile target (`make format`) to format the code,
this requires clang-format (version 17 currently) to be installed locally.

Installing clang-format is straightforward on most OS and distros
(e.g. with https://apt.llvm.org/, brew install clang-format, etc), as this is part of quite commonly
used suite of tools and compilers (llvm / clang).

Additionally, a CI action is present that will verify if the code requires formatting,
and comment on the PR as needed. Initially, correct formatting is not required, it will be
done by maintainers as part of the merge or in later commits, but obviously this is encouraged.

fixes https://github.com/official-stockfish/Stockfish/issues/3608
closes https://github.com/official-stockfish/Stockfish/pull/4790

Co-Authored-By: Joost VandeVondele <Joost.VandeVondele@gmail.com>
49 files changed:
.clang-format [new file with mode: 0644]
.github/workflows/stockfish_format_check.yml [new file with mode: 0644]
CONTRIBUTING.md
src/Makefile
src/benchmark.cpp
src/benchmark.h
src/bitboard.cpp
src/bitboard.h
src/evaluate.cpp
src/evaluate.h
src/main.cpp
src/misc.cpp
src/misc.h
src/movegen.cpp
src/movegen.h
src/movepick.cpp
src/movepick.h
src/nnue/evaluate_nnue.cpp
src/nnue/evaluate_nnue.h
src/nnue/features/half_ka_v2_hm.cpp
src/nnue/features/half_ka_v2_hm.h
src/nnue/layers/affine_transform.h
src/nnue/layers/affine_transform_sparse_input.h
src/nnue/layers/clipped_relu.h
src/nnue/layers/simd.h
src/nnue/layers/sqr_clipped_relu.h
src/nnue/nnue_accumulator.h
src/nnue/nnue_architecture.h
src/nnue/nnue_common.h
src/nnue/nnue_feature_transformer.h
src/position.cpp
src/position.h
src/search.cpp
src/search.h
src/syzygy/tbprobe.cpp
src/syzygy/tbprobe.h
src/thread.cpp
src/thread.h
src/thread_win32_osx.h
src/timeman.cpp
src/timeman.h
src/tt.cpp
src/tt.h
src/tune.cpp
src/tune.h
src/types.h
src/uci.cpp
src/uci.h
src/ucioption.cpp