diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 47a30e41652..2288b1e1af3 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -15,7 +15,7 @@ jobs: run: | set -e - brew install curl flake8 llvm@18 ninja shellcheck swift-format unzip + brew install curl flake8 llvm@19 ninja shellcheck swift-format unzip # Note: gn isn't available in homebrew :( # Corresponds to https://gn.googlesource.com/gn/+/225e90c5025bf74f41dbee60d9cde4512c846fe7 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2e3e8dd28c2..a879181b91b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,7 +66,7 @@ Nobody is perfect, and sometimes we mess things up. That said, here are some goo **Do:** * Write in idiomatic project-style C++23, using the `AK` containers in all code. -* Conform to the project coding style found in [CodingStyle.md](https://github.com/LadybirdBrowser/ladybird/blob/master/Documentation/CodingStyle.md). Use `clang-format` (version 18) to automatically format C++ files. See [AdvancedBuildInstructions.md](https://github.com/LadybirdBrowser/ladybird/blob/master/Documentation/AdvancedBuildInstructions.md#clang-format-updates) for instructions on how to get an up-to-date version if your OS distribution does not ship clang-format-18. +* Conform to the project coding style found in [CodingStyle.md](https://github.com/LadybirdBrowser/ladybird/blob/master/Documentation/CodingStyle.md). Use `clang-format` (version 19) to automatically format C++ files. See [AdvancedBuildInstructions.md](https://github.com/LadybirdBrowser/ladybird/blob/master/Documentation/AdvancedBuildInstructions.md#clang-format-updates) for instructions on how to get an up-to-date version if your OS distribution does not ship clang-format-19. * Choose expressive variable, function and class names. Make it as obvious as possible what the code is doing. * Split your changes into separate, atomic commits (i.e. A commit per feature or fix, where the build, tests and the system are all functioning). * Make sure your commits are rebased on the master branch. diff --git a/Documentation/CodingStyle.md b/Documentation/CodingStyle.md index 21b050ebb50..3d57505f2f1 100644 --- a/Documentation/CodingStyle.md +++ b/Documentation/CodingStyle.md @@ -2,7 +2,7 @@ For low-level styling (spaces, parentheses, brace placement, etc), all code should follow the format specified in `.clang-format` in the project root. -**Important: Make sure you use `clang-format` version 18!** +**Important: Make sure you use `clang-format` version 19!** This document describes the coding style used for C++ code in the Ladybird Browser project. All new code should conform to this style. @@ -505,7 +505,7 @@ wrapping or to insert necessary punctuation such as adding `**` when a number is done using elements like `` which do not appear in the copied text. Please wrap long comments onto multiple lines so that they are easier to read. Generally, 120 characters is a good width -to aim for. +to aim for. Use FIXME: (without attribution) to denote items that need to be addressed in the future. TODO: (without attribution) is also permitted. diff --git a/Documentation/EditorConfiguration/QtCreatorConfiguration.md b/Documentation/EditorConfiguration/QtCreatorConfiguration.md index 0b476ea1059..ca4861ba2b6 100644 --- a/Documentation/EditorConfiguration/QtCreatorConfiguration.md +++ b/Documentation/EditorConfiguration/QtCreatorConfiguration.md @@ -36,7 +36,7 @@ Qt Creator should be set up correctly now, go ahead and explore the project and ## Auto-Formatting -You can use `clang-format` to help you with the [style guide](../CodingStyle.md). Before you proceed, check that you're actually using clang-format version 18, as some OSes will ship other clang-format versions by default. +You can use `clang-format` to help you with the [style guide](../CodingStyle.md). Before you proceed, check that you're actually using the clang-format version specified in the style guide, as some OSes will ship other clang-format versions by default. - In QtCreator, go to "Help > About Plugins…" - Find the `Beautifier (experimental)` row (for example, by typing `beau` into the search) diff --git a/Meta/lint-clang-format.sh b/Meta/lint-clang-format.sh index 99f883020f1..b45751e7aa5 100755 --- a/Meta/lint-clang-format.sh +++ b/Meta/lint-clang-format.sh @@ -28,21 +28,21 @@ fi if (( ${#files[@]} )); then TOOLCHAIN_DIR=Toolchain/Local/clang/bin CLANG_FORMAT=false - if command -v clang-format-18 >/dev/null 2>&1 ; then - CLANG_FORMAT=clang-format-18 - elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@18)"/bin/clang-format >/dev/null 2>&1 ; then - CLANG_FORMAT="$(brew --prefix llvm@18)"/bin/clang-format - elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 18.' ; then + if command -v clang-format-19 >/dev/null 2>&1 ; then + CLANG_FORMAT=clang-format-19 + elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@19)"/bin/clang-format >/dev/null 2>&1 ; then + CLANG_FORMAT="$(brew --prefix llvm@19)"/bin/clang-format + elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 19.' ; then CLANG_FORMAT=$TOOLCHAIN_DIR/clang-format elif command -v clang-format >/dev/null 2>&1 ; then CLANG_FORMAT=clang-format - if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) != 18) exit 1; }'; then - echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 18." + if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) != 19) exit 1; }'; then + echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 19." echo "It is very likely that the resulting changes are not what you wanted." fi else - echo "clang-format-18 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-18." - echo "(If you install a package 'clang-format', please make sure it's version 18.)" + echo "clang-format-19 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-19." + echo "(If you install a package 'clang-format', please make sure it's version 19.)" exit 1 fi