Skip to content

Commit

Permalink
Upgrade formatter to clang-format-11 (#734)
Browse files Browse the repository at this point in the history
* Upgrade formatter to clang-format-11

* Add CHANGELOG entry
  • Loading branch information
isaacbrodsky committed Dec 7, 2022
1 parent ab09177 commit 975de7a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ jobs:
- name: Install Doxygen
run: |
sudo apt update
sudo apt-get install doxygen graphviz clang-format-9
sudo apt-get install doxygen graphviz clang-format-11
- name: Configure build
run: cmake -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DWARNINGS_AS_ERRORS=ON .

- name: Formatting check
working-directory: build
run: |
clang-format-9 --version
clang-format-11 --version
make format
git diff --exit-code
Expand Down Expand Up @@ -83,15 +83,15 @@ jobs:
- name: Install Doxygen
run: |
sudo apt update
sudo apt-get install doxygen graphviz clang-format-9
sudo apt-get install doxygen graphviz clang-format-11
- name: Configure build
run: cmake -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DWARNINGS_AS_ERRORS=ON -DCMAKE_C_FLAGS="${{ matrix.compile_opt }}" .

- name: Formatting check
working-directory: build
run: |
clang-format-9 --version
clang-format-11 --version
make format
git diff --exit-code
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The public API of this library consists of the functions declared in file

### Changed
- `assert` on defensive code blocks that are not already covered. (#720)
- `clang-format` upgraded to version 11. (#734)

## [4.0.1] - 2022-09-15
### Fixed
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ endfunction()
add_h3_library(h3 "")

# Automatic code formatting
# Give preference to clang-format-9
find_program(CLANG_FORMAT_PATH NAMES clang-format-9 clang-format)
# Give preference to clang-format-11
find_program(CLANG_FORMAT_PATH NAMES clang-format-11 clang-format)
cmake_dependent_option(
ENABLE_FORMAT "Enable running clang-format before compiling" ON
"CLANG_FORMAT_PATH" OFF)
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ Planned improvements and changes are listed on the [H3 Roadmap](https://github.c
## Pull requests

* Please include tests that show the bug is fixed or feature works as intended.
* Please include fuzzer tests for public API functions.
* Please add a description of your change to the Unreleased section of the [changelog](./CHANGELOG.md).
* Please open issues to discuss large features or changes which would break compatibility, before submitting pull requests.
* Please keep H3 compatible with major C compilers, such as GCC, Clang, and MSVC. We use clang-format-9 for source code formatting, if you have another version the CI job may error on formatting differences.
* Please keep H3 compatible with major C compilers, such as GCC, Clang, and MSVC. We use clang-format-11 for source code formatting, if you have another version the CI job may error on formatting differences.
* Please keep code coverage of the core H3 library at 100%.

Before we can merge your changes, you must agree to the [Uber Contributor License Agreement](https://cla-assistant.io/uber/h3).
Expand Down
2 changes: 1 addition & 1 deletion website/docs/core-library/compilation-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ but is rather the documentation for the internal C library functions.

## ENABLE_FORMAT

Whether to enable using clang-format-9 to format source files before building. This should be enabled
Whether to enable using clang-format-11 to format source files before building. This should be enabled
before submitting patches for H3 as continuous integration will fail if the formatting does not match.

Only this version of clang-format should be used to format the sources as new releases of clang-format
Expand Down
2 changes: 1 addition & 1 deletion website/docs/core-library/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Coverage information is collected in Coveralls. Because of the self-contained na

| Operating system | Compiler | Build type | Processor architecture | Special notes
| ---------------- | ----------- | -------------- | ---------------------- | -------------
| Linux (Ubuntu) | Clang | Debug, Release | x64 | clang-format-9 is used to ensure all code is consistently formatted
| Linux (Ubuntu) | Clang | Debug, Release | x64 | clang-format-11 is used to ensure all code is consistently formatted
| Linux | Clang | Debug | x64 | An additional copy of the job runs with [Valgrind](https://valgrind.org/)
| Linux | Clang | Debug | x64 | An additional copy of the job runs with coverage reporting, and excerising the `H3_PREFIX` mechanism.
| Linux | gcc | Debug, Release | x64 |
Expand Down

0 comments on commit 975de7a

Please sign in to comment.