From 6d88a3d9fe21250d7e8d88bd6cb18ee892446a29 Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 11:13:39 +0200 Subject: [PATCH 01/12] Update clang-format. --- .clang-format | 47 ++++++++++++++--- .clang-tidy | 56 +++++++++++++++++++++ .github/workflows/linter.yaml | 5 +- scripts/install_llvm.sh | 12 +++++ src/brayns/core/Launcher.h | 2 +- src/brayns/core/cli/CommandLine.h | 10 ++-- src/brayns/core/engine/Data.h | 2 +- src/brayns/core/jsonrpc/Errors.cpp | 16 +++--- src/brayns/core/jsonrpc/PayloadReflector.h | 8 +-- src/brayns/core/objects/common/Binary.h | 13 ++--- src/brayns/core/websocket/WebSocketServer.h | 2 +- tests/core/utils/TestBinary.cpp | 2 +- 12 files changed, 141 insertions(+), 34 deletions(-) create mode 100644 .clang-tidy create mode 100644 scripts/install_llvm.sh diff --git a/.clang-format b/.clang-format index 149f142e0..ce3992435 100644 --- a/.clang-format +++ b/.clang-format @@ -11,10 +11,10 @@ AlignEscapedNewlines: DontAlign AlignOperands: DontAlign AlignTrailingComments: false AllowAllArgumentsOnNextLine: false -AllowAllConstructorInitializersOnNextLine: false # Deprecated AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: Never @@ -26,13 +26,35 @@ AlwaysBreakTemplateDeclarations: Yes BinPackArguments: false BinPackParameters: false BitFieldColonSpacing: Both +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: true + BeforeElse: true + BeforeLambdaBody: true + BeforeWhile: true + IndentBraces: false + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakAdjacentStringLiterals: true +BreakAfterAttributes: Never +BreakAfterReturnType: Automatic BreakBeforeBinaryOperators: NonAssignment -BreakBeforeBraces: Allman -BreakBeforeConceptDeclarations: true +BreakBeforeBraces: Custom +BreakBeforeConceptDeclarations: Always BreakBeforeTernaryOperators: true BreakConstructorInitializers: AfterColon +BreakFunctionDefinitionParameters: false BreakInheritanceList: AfterColon -BreakStringLiterals: true +BreakStringLiterals: false +BreakTemplateDeclarations: Yes ColumnLimit: 120 CompactNamespaces: false ConstructorInitializerIndentWidth: 4 @@ -50,12 +72,21 @@ IndentCaseLabels: false IndentExternBlock: true IndentGotoLabels: false IndentPPDirectives: BeforeHash -IndentRequires: true +IndentRequiresClause: true IndentWidth: 4 IndentWrappedFunctionNames: true -KeepEmptyLinesAtTheStartOfBlocks: false +InsertBraces: true +IntegerLiteralSeparator: + Binary: -1 + Decimal: 3 + Hex: -1 +KeepEmptyLines: + AtEndOfFile: false + AtStartOfBlock: false + AtStartOfFile: false LambdaBodyIndentation: Signature Language: Cpp +MainIncludeChar: Quote MaxEmptyLinesToKeep: 1 NamespaceIndentation: None PackConstructorInitializers: Never @@ -73,7 +104,9 @@ PointerAlignment: Right QualifierAlignment: Custom QualifierOrder: ["static", "inline", "const", "volatile", "type"] ReferenceAlignment: Right -ReflowComments: true +ReflowComments: false +RequiresClausePosition: WithPreceding +RequiresExpressionIndentation: OuterScope SeparateDefinitionBlocks: Always ShortNamespaceLines: 1 SortIncludes: true diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 000000000..d61b2a97f --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,56 @@ +Checks: -* + bugprone-* + cert-* + concurrency-* + cppcoreguidelines-* + misc-* + modernize-* + performance-* + portability-* + readability-* + -cppcoreguidelines-avoid-magic-numbers + -cppcoreguidelines-missing-std-forward + -cppcoreguidelines-pro-* + -misc-include-cleaner + -modernize-use-nodiscard + -modernize-use-trailing-return-type + -readability-identifier-length + -readability-magic-numbers + +HeaderFilterRegex: "src/*" + +CheckOptions: + - key: readability-identifier-naming.ClassCase + value: CamelCase + - key: readability-identifier-naming.ClassMemberCase + value: CamelCase + - key: readability-identifier-naming.ConstexprVariableCase + value: CamelCase + - key: readability-identifier-naming.EnumCase + value: CamelCase + - key: readability-identifier-naming.EnumConstantCase + value: CamelCase + - key: readability-identifier-naming.FunctionCase + value: camelBack + - key: readability-identifier-naming.FunctionIgnoredRegexp + value: main|wmain|wWinMain|begin|end + - key: readability-identifier-naming.GlobalConstantCase + value: camelBack + - key: readability-identifier-naming.StaticConstantCase + value: camelBack + - key: readability-identifier-naming.StaticVariableCase + value: camelBack + - key: readability-identifier-naming.MacroDefinitionCase + value: UPPER_CASE + - key: readability-identifier-naming.MemberCase + value: camelBack + - key: readability-identifier-naming.PrivateMemberPrefix + value: _ + - key: readability-identifier-naming.NamespaceCase + value: camelBack + - key: readability-identifier-naming.ParameterCase + value: camelBack + - key: readability-identifier-naming.TypeAliasCase + value: CamelCase + - key: readability-identifier-naming.VariableCase + value: camelBack diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 89cf44a90..55ed04e06 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -13,6 +13,7 @@ jobs: uses: actions/checkout@v4 - name: Run clang-format run: | - apt update && apt install -y clang-format-15 + apt update + bash install_llvm.sh SOURCES=$(find apps src tests \( -name "*.h" -or -name "*.cpp" \)) - clang-format-15 --dry-run --Werror $SOURCES + clang-format-20 --dry-run --Werror $SOURCES diff --git a/scripts/install_llvm.sh b/scripts/install_llvm.sh new file mode 100644 index 000000000..41e262391 --- /dev/null +++ b/scripts/install_llvm.sh @@ -0,0 +1,12 @@ +# Copyright (c) 2015-2024, EPFL/Blue Brain Project +# All rights reserved. Do not distribute without permission. +# Responsible Author: Adrien Fleury +# +# This file is part of Brayns + +wget https://apt.llvm.org/llvm.sh +chmod +x llvm.sh +sudo ./llvm.sh 20 + +sudo apt install clang-format-20 +sudo apt install clang-tidy-20 diff --git a/src/brayns/core/Launcher.h b/src/brayns/core/Launcher.h index aa8aa4c1c..c4034fc72 100644 --- a/src/brayns/core/Launcher.h +++ b/src/brayns/core/Launcher.h @@ -71,7 +71,7 @@ struct ArgvSettingsReflector .defaultValue("localhost"); builder.option("port", [](auto &settings) { return &settings.port; }) .description("Websocket server port") - .defaultValue(5000); + .defaultValue(5'000); builder.option("max-thread-count", [](auto &settings) { return &settings.maxThreadCount; }) .description("Maximum number of threads for the websocket server") .defaultValue(10); diff --git a/src/brayns/core/cli/CommandLine.h b/src/brayns/core/cli/CommandLine.h index 9eb61c1f0..e979afc04 100644 --- a/src/brayns/core/cli/CommandLine.h +++ b/src/brayns/core/cli/CommandLine.h @@ -131,9 +131,11 @@ template struct ArgvReflector; template -concept ReflectedArgvOption = std::same_as::getType())> - && std::same_as::toString(T()))> - && std::same_as::parse(std::string_view()))>; +concept ReflectedArgvOption = requires(T value) { + { ArgvReflector::getType() } -> std::same_as; + { ArgvReflector::toString(value) } -> std::same_as; + { ArgvReflector::parse(std::string_view()) } -> std::same_as; +}; template<> struct ArgvReflector @@ -160,7 +162,7 @@ struct ArgvReflector }; template - requires std::is_arithmetic_v +requires std::is_arithmetic_v struct ArgvReflector { static std::string getType() diff --git a/src/brayns/core/engine/Data.h b/src/brayns/core/engine/Data.h index 0eb573643..895eafacc 100644 --- a/src/brayns/core/engine/Data.h +++ b/src/brayns/core/engine/Data.h @@ -178,7 +178,7 @@ Data allocateData(Device &device, std::size_t itemCount) } template - requires(std::convertible_to, T>) +requires std::convertible_to, T> Data createData(Device &device, U &&items) { auto data = allocateData(device, items.size()); diff --git a/src/brayns/core/jsonrpc/Errors.cpp b/src/brayns/core/jsonrpc/Errors.cpp index ee8197e00..0b2d48bb9 100644 --- a/src/brayns/core/jsonrpc/Errors.cpp +++ b/src/brayns/core/jsonrpc/Errors.cpp @@ -58,42 +58,42 @@ const JsonValue &JsonRpcException::getData() const } ParseError::ParseError(const std::string &message): - JsonRpcException(-32700, message) + JsonRpcException(-32'700, message) { } InvalidRequest::InvalidRequest(const std::string &message): - JsonRpcException(-32600, message) + JsonRpcException(-32'600, message) { } InvalidRequest::InvalidRequest(const std::string &message, const std::vector &errors): - JsonRpcException(-32600, message, serializeToJson(errors)) + JsonRpcException(-32'600, message, serializeToJson(errors)) { } MethodNotFound::MethodNotFound(const std::string &method): - JsonRpcException(-32601, fmt::format("Method not found: '{}'", method)) + JsonRpcException(-32'601, fmt::format("Method not found: '{}'", method)) { } InvalidParams::InvalidParams(const std::string &message): - JsonRpcException(-32602, message) + JsonRpcException(-32'602, message) { } InvalidParams::InvalidParams(const std::string &message, const std::vector &errors): - JsonRpcException(-32602, message, serializeToJson(errors)) + JsonRpcException(-32'602, message, serializeToJson(errors)) { } InternalError::InternalError(const std::string &message): - JsonRpcException(-32603, message) + JsonRpcException(-32'603, message) { } InternalError::InternalError(const std::exception &e): - JsonRpcException(-32603, e.what()) + JsonRpcException(-32'603, e.what()) { } } diff --git a/src/brayns/core/jsonrpc/PayloadReflector.h b/src/brayns/core/jsonrpc/PayloadReflector.h index 9a942443b..a734c26bb 100644 --- a/src/brayns/core/jsonrpc/PayloadReflector.h +++ b/src/brayns/core/jsonrpc/PayloadReflector.h @@ -35,9 +35,11 @@ template struct PayloadReflector; template -concept ReflectedPayload = std::same_as::getSchema())> - && std::same_as::serialize(std::declval()))> - && std::same_as::deserialize(Payload()))>; +concept ReflectedPayload = requires(T value) { + { PayloadReflector::getSchema() } -> std::same_as; + { PayloadReflector::serialize(std::move(value)) } -> std::same_as; + { PayloadReflector::deserialize(Payload()) } -> std::same_as; +}; template<> struct PayloadReflector diff --git a/src/brayns/core/objects/common/Binary.h b/src/brayns/core/objects/common/Binary.h index 83e3489e0..dfc2b74b2 100644 --- a/src/brayns/core/objects/common/Binary.h +++ b/src/brayns/core/objects/common/Binary.h @@ -70,12 +70,13 @@ Data3D createData3DFromBinaryOf(Device &device, const Size3 &itemCount, std:: if (reduceMultiply(itemCount) != totalItemCount) { - throw InvalidParams(fmt::format( - "Item count in binary {} does not match given item count {}x{}x{}", - totalItemCount, - itemCount.x, - itemCount.y, - itemCount.z)); + throw InvalidParams( + fmt::format( + "Item count in binary {} does not match given item count {}x{}x{}", + totalItemCount, + itemCount.x, + itemCount.y, + itemCount.z)); } auto data = allocateData3D(device, itemCount); diff --git a/src/brayns/core/websocket/WebSocketServer.h b/src/brayns/core/websocket/WebSocketServer.h index 298403cc8..c70581cb6 100644 --- a/src/brayns/core/websocket/WebSocketServer.h +++ b/src/brayns/core/websocket/WebSocketServer.h @@ -45,7 +45,7 @@ struct SslSettings struct WebSocketServerSettings { std::string host = "localhost"; - std::uint16_t port = 5000; + std::uint16_t port = 5'000; std::size_t maxThreadCount = 1; std::size_t maxQueueSize = 64; std::size_t maxFrameSize = std::numeric_limits::max(); diff --git a/tests/core/utils/TestBinary.cpp b/tests/core/utils/TestBinary.cpp index 0e1d13e0f..a5c796bc0 100644 --- a/tests/core/utils/TestBinary.cpp +++ b/tests/core/utils/TestBinary.cpp @@ -47,7 +47,7 @@ TEST_CASE("As bytes") swapBytes(test); - CHECK_EQ(test, 16777216); + CHECK_EQ(test, 16'777'216); swapBytes(test); From 4b70fbe44cfeeeea421c1630d2188cefa9de725e Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 15:25:06 +0200 Subject: [PATCH 02/12] Add clang-tidy. --- .clang-tidy | 3 ++- README.md | 20 ++++++++++++++++++++ src/brayns/core/codecs/PngCodec.cpp | 2 +- src/brayns/core/engine/Data.h | 4 ++-- src/brayns/core/json/JsonSchema.h | 2 +- src/brayns/core/utils/Binary.h | 12 ++++++++---- src/brayns/core/utils/Filesystem.cpp | 7 +++++-- src/brayns/core/utils/Math.h | 2 -- tests/core/codecs/TestCodecs.cpp | 2 +- tests/core/engine/TestRender.cpp | 4 ++-- 10 files changed, 42 insertions(+), 16 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index d61b2a97f..1c945da2f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -17,7 +17,8 @@ Checks: -* -readability-identifier-length -readability-magic-numbers -HeaderFilterRegex: "src/*" +WarningsAsErrors: "*" +HeaderFilterRegex: "src/.*" CheckOptions: - key: readability-identifier-naming.ClassCase diff --git a/README.md b/README.md index efa661877..731574638 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,26 @@ The following cmake options (shown with their default value) can be used during * **BRAYNS_ENABLE_CIRCUITS** (Default ON) - Activate circuit support. * **BRAYNS_ENABLE_ATLAS** - (Default ON) Activate atlas support. +### Run linters + +Run clang format as follows: + + $ SOURCES=$(find apps src tests \( -name "*.h" -or -name "*.cpp" \)) + $ clang-format-20 --Werror $SOURCES + +Run clang tidy as follows: + +Use cmake config to generate build commands: + +"cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": true, + "CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES": "/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11" +} + +Run with + + $ run-clang-tidy-20 -p build/user-debug -quiet -line-filter='["name": "CHECK_"]' + ## Running diff --git a/src/brayns/core/codecs/PngCodec.cpp b/src/brayns/core/codecs/PngCodec.cpp index a0884dcd2..0d3448032 100644 --- a/src/brayns/core/codecs/PngCodec.cpp +++ b/src/brayns/core/codecs/PngCodec.cpp @@ -65,7 +65,7 @@ std::string encodePng(const ImageView &image) .message = {}, }; - auto rowStride = PNG_IMAGE_ROW_STRIDE(png); + auto rowStride = png_int_32(PNG_IMAGE_ROW_STRIDE(png)); if (rowOrder == RowOrder::BottomUp) { diff --git a/src/brayns/core/engine/Data.h b/src/brayns/core/engine/Data.h index 895eafacc..ce1d9d624 100644 --- a/src/brayns/core/engine/Data.h +++ b/src/brayns/core/engine/Data.h @@ -249,7 +249,7 @@ Data3D createDataView3D(const Data3D &data, const DataRegion3D &r template Data2D createDataView2D(const Data2D &data, const DataRegion2D ®ion) { - auto region3D = DataRegion3D{Size3(region.itemCount, 1), Size3(region.stride, 0), region.offset}; + auto region3D = DataRegion3D{Size3(region.itemCount, 1), Stride3(region.stride, 0), region.offset}; auto view = createDataView3D(data, region3D); return Data2D(std::move(view)); } @@ -257,7 +257,7 @@ Data2D createDataView2D(const Data2D &data, const DataRegion2D &r template Data createDataView(const Data &data, const DataRegion ®ion) { - auto region3D = DataRegion3D{Size3(region.itemCount, 1, 1), Size3(region.stride, 0, 0), region.offset}; + auto region3D = DataRegion3D{Size3(region.itemCount, 1, 1), Stride3(region.stride, 0, 0), region.offset}; auto view = createDataView3D(data, region3D); return Data(std::move(view)); } diff --git a/src/brayns/core/json/JsonSchema.h b/src/brayns/core/json/JsonSchema.h index f93a2ffca..f45c37607 100644 --- a/src/brayns/core/json/JsonSchema.h +++ b/src/brayns/core/json/JsonSchema.h @@ -173,6 +173,6 @@ struct JsonSchema std::optional maxItems = {}; std::map properties = {}; - auto operator<=>(const JsonSchema &) const = default; + bool operator==(const JsonSchema &) const = default; }; } diff --git a/src/brayns/core/utils/Binary.h b/src/brayns/core/utils/Binary.h index b4ca035fb..46a60a1ff 100644 --- a/src/brayns/core/utils/Binary.h +++ b/src/brayns/core/utils/Binary.h @@ -90,7 +90,9 @@ void composeBytesAsPrimtive(const T &value, std::endian endian, std::string &out if (endian != std::endian::native) { - auto first = output.begin() + output.size() - size; + auto offset = static_cast(output.size() - size); + + auto first = output.begin() + offset; auto last = output.end(); auto appended = std::span(first, last); @@ -166,14 +168,16 @@ std::string composeBytes(const T &value, std::endian endian) template struct BinaryReflector> { + static constexpr auto componentCount = static_cast(S); + static std::size_t getSize() { - return static_cast(S) * sizeof(T); + return componentCount * sizeof(T); } static void extract(std::string_view &bytes, std::endian endian, Vector &output) { - for (auto i = 0; i < S; ++i) + for (auto i = std::size_t(0); i < componentCount; ++i) { extractBytesTo(bytes, endian, output[i]); } @@ -181,7 +185,7 @@ struct BinaryReflector> static void compose(const Vector &value, std::endian endian, std::string &output) { - for (auto i = 0; i < S; ++i) + for (auto i = std::size_t(0); i < componentCount; ++i) { composeBytesTo(value[i], endian, output); } diff --git a/src/brayns/core/utils/Filesystem.cpp b/src/brayns/core/utils/Filesystem.cpp index c9460e42b..b6aae8ce2 100644 --- a/src/brayns/core/utils/Filesystem.cpp +++ b/src/brayns/core/utils/Filesystem.cpp @@ -49,7 +49,7 @@ std::string readFile(const std::filesystem::path &path) } auto size = stream.tellg(); - auto data = std::string(size, '\0'); + auto data = std::string(static_cast(size), '\0'); stream.seekg(0); stream.read(data.data(), size); @@ -66,6 +66,9 @@ void writeFile(std::string_view data, const std::filesystem::path &path) throw std::runtime_error(fmt::format("Failed to open file '{}' in write mode", path)); } - stream.write(data.data(), data.size()); + const auto *ptr = data.data(); + auto size = static_cast(data.size()); + + stream.write(ptr, size); } } diff --git a/src/brayns/core/utils/Math.h b/src/brayns/core/utils/Math.h index ddb8d26e0..26aa79832 100644 --- a/src/brayns/core/utils/Math.h +++ b/src/brayns/core/utils/Math.h @@ -110,8 +110,6 @@ struct Transform Vector3 translation = {0.0F, 0.0F, 0.0F}; Quaternion rotation = {1.0F, 0.0F, 0.0F, 0.0F}; Vector3 scale = {1.0F, 1.0F, 1.0F}; - - auto operator<=>(const Transform &other) const = default; }; inline Affine3 toAffine(const Transform &transform) diff --git a/tests/core/codecs/TestCodecs.cpp b/tests/core/codecs/TestCodecs.cpp index 097257503..3f519da33 100644 --- a/tests/core/codecs/TestCodecs.cpp +++ b/tests/core/codecs/TestCodecs.cpp @@ -39,7 +39,7 @@ TestImage createTestImage(ImageFormat format) { auto width = std::size_t(200); auto height = std::size_t(100); - auto pixelSize = format == ImageFormat::Rgb8 ? 3 : 4; + auto pixelSize = format == ImageFormat::Rgb8 ? std::size_t(3) : std::size_t(4); auto rowSize = width * pixelSize; auto size = rowSize * height; auto rowOrder = RowOrder::BottomUp; diff --git a/tests/core/engine/TestRender.cpp b/tests/core/engine/TestRender.cpp index 2c56ff74e..aa52d2034 100644 --- a/tests/core/engine/TestRender.cpp +++ b/tests/core/engine/TestRender.cpp @@ -73,10 +73,10 @@ TEST_CASE("Object creation") createVolumetricModel(device, {volume, transferFunction}); auto triangles = std::vector{{0, 0, 0}, {1, 1, 1}, {2, 2, 2}}; - createTriangleMesh(device, {createData(device, triangles)}); + createTriangleMesh(device, {{createData(device, triangles)}}); auto quads = std::vector{{0, 0, 0}, {1, 1, 1}, {2, 2, 2}, {3, 3, 3}}; - createQuadMesh(device, {createData(device, quads)}); + createQuadMesh(device, {{createData(device, quads)}}); auto spheres = std::vector{{0, 0, 0, 1}, {1, 1, 1, 1}}; auto geometry = createSpheres(device, {createData(device, spheres)}); From deea288657dc22fbec3f1c0456ade2bd5b06e53d Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 15:32:33 +0200 Subject: [PATCH 03/12] Fixes. --- .github/workflows/linter.yaml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 55ed04e06..33dab35b3 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -14,6 +14,6 @@ jobs: - name: Run clang-format run: | apt update - bash install_llvm.sh + bash scripts/install_llvm.sh SOURCES=$(find apps src tests \( -name "*.h" -or -name "*.cpp" \)) clang-format-20 --dry-run --Werror $SOURCES diff --git a/README.md b/README.md index 731574638..6a98dee7e 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Use cmake config to generate build commands: Run with - $ run-clang-tidy-20 -p build/user-debug -quiet -line-filter='["name": "CHECK_"]' + $ run-clang-tidy-20 -p build/user-debug ## Running From 96536f1f7effc3e7be842947a6e51bfd60f050e1 Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 15:38:21 +0200 Subject: [PATCH 04/12] Try fix linter. --- .github/workflows/linter.yaml | 2 +- scripts/install_llvm.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 33dab35b3..53acabcd4 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v4 - name: Run clang-format run: | - apt update + apt-get update bash scripts/install_llvm.sh SOURCES=$(find apps src tests \( -name "*.h" -or -name "*.cpp" \)) clang-format-20 --dry-run --Werror $SOURCES diff --git a/scripts/install_llvm.sh b/scripts/install_llvm.sh index 41e262391..ce6848d30 100644 --- a/scripts/install_llvm.sh +++ b/scripts/install_llvm.sh @@ -6,7 +6,7 @@ wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh -sudo ./llvm.sh 20 +./llvm.sh 20 -sudo apt install clang-format-20 -sudo apt install clang-tidy-20 +apt-get install clang-format-20 +apt-get install clang-tidy-20 From c61d3e7ef1824c478fdcdced2ea139a56dbe8ef0 Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 15:39:48 +0200 Subject: [PATCH 05/12] Try fix linter. --- .github/workflows/linter.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 53acabcd4..1d13be30e 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -14,6 +14,13 @@ jobs: - name: Run clang-format run: | apt-get update - bash scripts/install_llvm.sh + + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + ./llvm.sh 20 + + apt-get install clang-format-20 + apt-get install clang-tidy-20 + SOURCES=$(find apps src tests \( -name "*.h" -or -name "*.cpp" \)) clang-format-20 --dry-run --Werror $SOURCES From 621c8d9d6a046d43f5a46e3d0ff966f92ab6e6a8 Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 15:43:51 +0200 Subject: [PATCH 06/12] Try fix CI. --- .github/workflows/linter.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 1d13be30e..92aa930d6 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -13,14 +13,14 @@ jobs: uses: actions/checkout@v4 - name: Run clang-format run: | - apt-get update + sudo apt-get update wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - ./llvm.sh 20 + sudo chmod +x llvm.sh + sudo ./llvm.sh 20 - apt-get install clang-format-20 - apt-get install clang-tidy-20 + sudo apt-get install clang-format-20 + sudo apt-get install clang-tidy-20 SOURCES=$(find apps src tests \( -name "*.h" -or -name "*.cpp" \)) clang-format-20 --dry-run --Werror $SOURCES From 07b191ce023a7d12b7519cb2c0af0f76ebaea552 Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 15:45:39 +0200 Subject: [PATCH 07/12] Try fix CI. --- .github/workflows/linter.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 92aa930d6..78ab3ad51 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -19,8 +19,8 @@ jobs: sudo chmod +x llvm.sh sudo ./llvm.sh 20 - sudo apt-get install clang-format-20 - sudo apt-get install clang-tidy-20 + sudo apt-get -y install clang-format-20 + sudo apt-get -y install clang-tidy-20 SOURCES=$(find apps src tests \( -name "*.h" -or -name "*.cpp" \)) clang-format-20 --dry-run --Werror $SOURCES From f31bdfc77c291264be572cc815bc9fd6060b27f6 Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 15:46:12 +0200 Subject: [PATCH 08/12] Try fix CI. --- .github/workflows/linter.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 78ab3ad51..de8a9ca90 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -14,13 +14,3 @@ jobs: - name: Run clang-format run: | sudo apt-get update - - wget https://apt.llvm.org/llvm.sh - sudo chmod +x llvm.sh - sudo ./llvm.sh 20 - - sudo apt-get -y install clang-format-20 - sudo apt-get -y install clang-tidy-20 - - SOURCES=$(find apps src tests \( -name "*.h" -or -name "*.cpp" \)) - clang-format-20 --dry-run --Werror $SOURCES From a05352eb34e0fec9fb98130b1eb2894ecdc0a530 Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 15:47:37 +0200 Subject: [PATCH 09/12] Try fix CI. --- .github/workflows/linter.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index de8a9ca90..c35e72961 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -13,4 +13,8 @@ jobs: uses: actions/checkout@v4 - name: Run clang-format run: | - sudo apt-get update + apt-get update + + wget https://apt.llvm.org/llvm.sh + sudo chmod +x llvm.sh + sudo ./llvm.sh 20 From 3ac91cb62c0effef4e72152b672208aa53df93b1 Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 15:52:48 +0200 Subject: [PATCH 10/12] Try fix CI. --- .github/workflows/linter.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index c35e72961..d48de4956 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -16,5 +16,9 @@ jobs: apt-get update wget https://apt.llvm.org/llvm.sh - sudo chmod +x llvm.sh - sudo ./llvm.sh 20 + bash llvm.sh 20 + + sudo apt-get -y install clang-format-20 + + SOURCES=$(find apps src tests \( -name "*.h" -or -name "*.cpp" \)) + clang-format-20 --dry-run --Werror $SOURCES From b2f852e563eb3a8a8cdc0f480257082c924c0251 Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 15:56:25 +0200 Subject: [PATCH 11/12] Try fix CI. --- .github/workflows/linter.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index d48de4956..5ce8cd256 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -16,7 +16,7 @@ jobs: apt-get update wget https://apt.llvm.org/llvm.sh - bash llvm.sh 20 + sudo bash llvm.sh 20 sudo apt-get -y install clang-format-20 From d383503328d8bd935b974b1a1e9d860519a83a3d Mon Sep 17 00:00:00 2001 From: Adrien4193 Date: Mon, 9 Sep 2024 16:08:45 +0200 Subject: [PATCH 12/12] Try fix CI. --- .github/workflows/linter.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 5ce8cd256..b13c165c9 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -11,14 +11,15 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Run clang-format + - name: Update APT package list + run: sudo apt-get update + - name: Download and install LLVM run: | - apt-get update - wget https://apt.llvm.org/llvm.sh sudo bash llvm.sh 20 - - sudo apt-get -y install clang-format-20 - + - name: Install clang-format + run: sudo apt-get -y install clang-format-20 + - name: Run clang-format + run: | SOURCES=$(find apps src tests \( -name "*.h" -or -name "*.cpp" \)) clang-format-20 --dry-run --Werror $SOURCES