summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.clang-format8
-rw-r--r--.github/workflows/ci.yml7
-rw-r--r--client/settings.hpp12
-rw-r--r--server/main/session.cpp7
-rw-r--r--server/main/settings.hpp3
-rw-r--r--test/unit_tests/lexer.cpp4
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<std::vector<std::string>>(&m_settings.m_files),
+ m_hidden.add_options()("files",
+ po::value<std::vector<std::string>>(&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,