style: Raise our formatting standard to clang-format 17 (#1761)
We had been using clang-format 14. Bump to 17 as our official reference standard for formatting. Moved the clang-format CI test from an aswf container to bare Ubuntu to make it run faster -- it doesn't need to do a real build, so there's no point wasting 2 minutes or so downloading a container holding library dependencies it won't need. Also fix a duplicate line in .clang-format that newer clang-format complained about. Document that it's specifically clang-format 17 that is our formatting standard Signed-off-by: Larry Gritz <lg@larrygritz.com>
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
Language: Cpp
|
||||
BasedOnStyle: WebKit
|
||||
SpaceBeforeParens: ControlStatements
|
||||
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
|
||||
@@ -18,6 +18,6 @@
|
||||
- [ ] I have updated the documentation, if applicable.
|
||||
- [ ] I have ensured that the change is tested somewhere in the testsuite (adding new test cases if necessary).
|
||||
- [ ] My code follows the prevailing code style of this project. If I haven't
|
||||
already run clang-format before submitting, I definitely will look at the CI
|
||||
test that runs clang-format and fix anything that it highlights as being
|
||||
nonconforming.
|
||||
already run clang-format v17 before submitting, I definitely will look at
|
||||
the CI test that runs clang-format and fix anything that it highlights as
|
||||
being nonconforming.
|
||||
|
||||
+22
-19
@@ -217,25 +217,6 @@ jobs:
|
||||
# texture system adequately and is able to ignore the benign
|
||||
# "leaks."
|
||||
|
||||
# Test formatting. This test entry doesn't do a full build, it
|
||||
# just runs clang-format on everything, and passes if nothing is
|
||||
# misformatted. Upon failure, the build artifact will be the full
|
||||
# source code with the formatting fixed (diffs will also appear in
|
||||
# the console output).
|
||||
- desc: "clang-format"
|
||||
nametag: clang-format
|
||||
runner: ubuntu-latest
|
||||
container: aswftesting/ci-osl:2022-clang14
|
||||
vfxyear: 2022
|
||||
cxx_std: 17
|
||||
openimageio_ver: release
|
||||
python_ver: 3.9
|
||||
simd: avx2,f16c
|
||||
batched: b8_AVX2
|
||||
skip_tests: 1
|
||||
setenvs: export BUILDTARGET=clang-format
|
||||
OPENIMAGEIO_CMAKE_FLAGS=-DUSE_PYTHON=0
|
||||
|
||||
# Test ABI stability. `abi_check` is the version or commit that we
|
||||
# believe is the current standard against which we don't want to
|
||||
# break the ABI. Basically, we will build that version as well as
|
||||
@@ -429,6 +410,27 @@ jobs:
|
||||
LLVM_DISTRO_NAME=ubuntu-18.04
|
||||
OPENCOLORIO_VERSION=v2.1.2
|
||||
PUGIXML_VERSION=v1.11.4
|
||||
# Test formatting. This test entry doesn't do a full build, it
|
||||
# just runs clang-format on everything, and passes if nothing is
|
||||
# misformatted. Upon failure, the build artifact will be the full
|
||||
# source code with the formatting fixed (diffs will also appear in
|
||||
# the console output).
|
||||
- desc: "clang-format"
|
||||
nametag: clang-format
|
||||
runner: ubuntu-latest
|
||||
container: aswftesting/ci-osl:2022-clang14
|
||||
cxx_std: 17
|
||||
extra_artifacts: "src/*.*"
|
||||
openimageio_ver: release
|
||||
python_ver: "3.10"
|
||||
simd: avx2,f16c
|
||||
batched: b8_AVX2
|
||||
skip_tests: 1
|
||||
setenvs: export BUILDTARGET=clang-format
|
||||
LLVM_VERSION=17.0.6
|
||||
LLVM_DISTRO_NAME=ubuntu-22.04
|
||||
OPENIMAGEIO_CMAKE_FLAGS=-DUSE_PYTHON=0
|
||||
QT_VERSION=0
|
||||
|
||||
runs-on: ${{matrix.runner}}
|
||||
env:
|
||||
@@ -483,6 +485,7 @@ jobs:
|
||||
build/*.cmake
|
||||
build/CMake*
|
||||
build/testsuite/*/*.*
|
||||
${{ matrix.extra_artifacts }}
|
||||
|
||||
|
||||
macos:
|
||||
|
||||
+4
-3
@@ -115,7 +115,8 @@ own repository on GitHub, and then clone it to get a repository on your
|
||||
local machine.
|
||||
|
||||
2. Edit, compile, and test your changes. Run clang-format (see the
|
||||
instructions on coding style below).
|
||||
instructions on coding style below). Our current formatting standard,
|
||||
as checked by our CI, uses clang-format 17.0.
|
||||
|
||||
3. Push your changes to your fork (each unrelated pull request to a separate
|
||||
"topic branch", please).
|
||||
@@ -170,14 +171,14 @@ file in which it appears.
|
||||
|
||||
#### Formatting
|
||||
|
||||
We use [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
|
||||
We use [clang-format](https://clang.llvm.org/docs/ClangFormat.html) v17
|
||||
to uniformly format our source code prior to PR submission. Make sure that
|
||||
clang-format is installed on your local machine, and just run
|
||||
|
||||
make clang-format
|
||||
|
||||
and it will automatically reformat your code according to the configuration
|
||||
file found in the `.clang-format` file at the root directory of the OIIO
|
||||
file found in the `.clang-format` file at the root directory of the OSL
|
||||
source code checkout.
|
||||
|
||||
One of the CI test matrix entries runs clang-format and fails if any
|
||||
|
||||
Reference in New Issue
Block a user