From 5496c777576624f00e49b2997f4a96bea23517b7 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 13 Jun 2026 00:01:24 +0200 Subject: unify my .clang-format files --- .clang-format | 8 +++++++- .github/workflows/ci.yml | 7 +++++++ client/settings.hpp | 12 ++++++++---- server/main/session.cpp | 7 +++++-- server/main/settings.hpp | 3 ++- test/unit_tests/lexer.cpp | 4 ++-- 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/.clang-format b/.clang-format index c73d105..ca228ce 100644 --- a/.clang-format +++ b/.clang-format @@ -2,13 +2,19 @@ Language: Cpp BasedOnStyle: Chromium +IndentWidth: 4 + AccessModifierOffset: -4 +AlignConsecutiveMacros: AcrossComments AllowShortFunctionsOnASingleLine: Empty +BinPackArguments: false +BreakConstructorInitializers: BeforeComma +BreakInheritanceList: BeforeComma BreakStringLiterals: false ColumnLimit: 100 IncludeBlocks: Regroup -IndentWidth: 4 SpacesBeforeTrailingComments: 1 +WrapNamespaceBodyWithEmptyLines: Always IncludeCategories: - Regex: '^".+' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75aa3b0..64e3166 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,15 @@ jobs: uses: actions/checkout@v6 with: submodules: recursive + - name: Set up clang-format + uses: egor-tensin/setup-clang@v2 + with: + # To use the latest clang-format features: + version: 22 - name: Run clang-format uses: egor-tensin/clang-format@v1 + with: + version: 22 build: strategy: diff --git a/client/settings.hpp b/client/settings.hpp index 806e644..b351282 100644 --- a/client/settings.hpp +++ b/client/settings.hpp @@ -48,14 +48,18 @@ public: namespace po = boost::program_options; m_visible.add_options()("help,h", "show this message and exit"); - m_visible.add_options()("command,c", po::value(&m_settings.m_input), + m_visible.add_options()("command,c", + po::value(&m_settings.m_input), "evaluate the argument expression and exit"); - m_visible.add_options()("host,H", po::value(&m_settings.m_host)->default_value("localhost"), + m_visible.add_options()("host,H", + po::value(&m_settings.m_host)->default_value("localhost"), "server host address"); m_visible.add_options()( - "port,p", po::value(&m_settings.m_port)->default_value(NetworkTransport::DEFAULT_PORT), + "port,p", + po::value(&m_settings.m_port)->default_value(NetworkTransport::DEFAULT_PORT), "server port number"); - m_hidden.add_options()("files", po::value>(&m_settings.m_files), + m_hidden.add_options()("files", + po::value>(&m_settings.m_files), "shouldn't be visible"); m_positional.add("files", -1); } diff --git a/server/main/session.cpp b/server/main/session.cpp index 8a6bb13..6d615ff 100644 --- a/server/main/session.cpp +++ b/server/main/session.cpp @@ -69,7 +69,9 @@ void Session::read() { // Stop at LF boost::asio::async_read_until( - m_socket, m_buffer, '\n', + m_socket, + m_buffer, + '\n', boost::asio::bind_executor( m_strand, [this, self](const boost::system::error_code& ec, std::size_t bytes) { handle_read(ec, bytes); @@ -101,7 +103,8 @@ void Session::write(const std::string& output) { os << output << "\r\n"; boost::asio::async_write( - m_socket, m_buffer, + m_socket, + m_buffer, boost::asio::bind_executor( m_strand, [this, self](const boost::system::error_code& ec, std::size_t bytes) { handle_write(ec, bytes); diff --git a/server/main/settings.hpp b/server/main/settings.hpp index 9d3eed0..16d9ecb 100644 --- a/server/main/settings.hpp +++ b/server/main/settings.hpp @@ -41,7 +41,8 @@ public: m_visible.add_options()("help,h", "show this message and exit"); m_visible.add_options()( - "port,p", po::value(&m_settings.m_port)->default_value(Settings::DEFAULT_PORT), + "port,p", + po::value(&m_settings.m_port)->default_value(Settings::DEFAULT_PORT), "server port number"); m_visible.add_options()( "threads,n", diff --git a/test/unit_tests/lexer.cpp b/test/unit_tests/lexer.cpp index ea5363f..bfb752a 100644 --- a/test/unit_tests/lexer.cpp +++ b/test/unit_tests/lexer.cpp @@ -155,8 +155,8 @@ BOOST_DATA_TEST_CASE(test_get_tokens_valid, expected) { Lexer lexer{input}; const auto actual = lexer.get_tokens(); - BOOST_CHECK_EQUAL_COLLECTIONS(actual.cbegin(), actual.cend(), expected.cbegin(), - expected.cend()); + BOOST_CHECK_EQUAL_COLLECTIONS( + actual.cbegin(), actual.cend(), expected.cbegin(), expected.cend()); } BOOST_DATA_TEST_CASE(test_get_tokens_invalid, -- cgit v1.3