Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 51 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,55 +94,77 @@ jobs:

- name: Install dependencies
run: |
# Install LLVM 19 with libc++
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | \
sudo tee /etc/apt/trusted.gpg.d/llvm.asc
sudo add-apt-repository -y \
'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main'
sudo apt-get update
sudo apt-get install -y \
clang-tidy \
gcc-14 \
g++-14 \
clang-19 \
clang-tidy-19 \
llvm-19 \
llvm-19-dev \
lld-19 \
libc++-19-dev \
libc++abi-19-dev \
cmake \
ninja-build \
libudev-dev \
libsystemd-dev \
pkg-config

- name: Cache clang-tidy results
uses: actions/cache@v4
with:
path: .clang-tidy-cache
key: >-
clang-tidy-${{ runner.os }}-${{
hashFiles('**/*.cpp', '**/*.cc', '**/*.h', '**/*.hpp',
'.clang-tidy') }}
restore-keys: |
clang-tidy-${{ runner.os }}-

- name: Configure CMake for clang-tidy
run: |
mkdir -p build
cd build
cmake .. -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++ -lc++abi" \
-DLLVM_CONFIG=/usr/bin/llvm-config-19

sed -i \
-e 's/-fdeps-format=p1689r5//g' \
-e 's/-fmodules-ts//g' \
-e 's/-fmodule-mapper=[^ ]*//g' \
-e 's/@[^ ]*\.modmap//g' \
compile_commands.json

env:
CC: gcc-14
CXX: g++-14
CC: clang-19
CXX: clang++-19

- name: Run clang-tidy
run: |
# Create cache directory if it doesn't exist
mkdir -p .clang-tidy-cache

# Find all C++ source files and run clang-tidy
# Exclude third_party directory from analysis
find src -type f \( -name "*.cpp" -o -name "*.cc" \) | \
while read file; do
echo "Analyzing $file..."
clang-tidy "$file" \
-p build \
--warnings-as-errors='*' \
--header-filter='^(?!.*third_party).*$' \
--system-headers=false || exit 1
done
export FILE_LIST=$(find src -type d -name third_party -prune -false -o -name '*.cc' -o -name '*.hpp' -o -name '*.h')

clang-tidy-19 --version
clang-tidy-19 --help

clang-tidy-19 \
-p build \
-export-fixes=tidy-results-suggested-fixes.txt \
-extra-arg='-Ithird_party/glaze/include' \
-extra-arg='-Ithird_party/sdbus-cpp/include' \
-extra-arg='-Ithird_party/spdlog/include' \
-warnings-as-errors='*' \
-header-filter='^(?!.*third_party).*$' \
--dump-config

run-clang-tidy-19 \
-p build \
-export-fixes=tidy-results-suggested-fixes.txt \
-extra-arg='-Ithird_party/glaze/include' \
-extra-arg='-Ithird_party/sdbus-cpp/include' \
-extra-arg='-Ithird_party/spdlog/include' \
-warnings-as-errors='*' \
-header-filter='^(?!.*third_party).*$' \
$FILE_LIST

shell: bash

build:
Expand Down
16 changes: 12 additions & 4 deletions interfaces/org/freedesktop/ModemManager1/ModemManager1.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
<node>
<interface name="org.freedesktop.ModemManager1">
<method name="ScanDevices"/>
<method name="SetLogging"><arg type="s" name="level" direction="in"/></method>
<method name="ReportKernelEvent"><arg type="a{sv}" name="properties" direction="in"/></method>
<method name="InhibitDevice"><arg type="s" name="uid" direction="in"/><arg type="b" name="inhibit" direction="in"/></method>
<property type="s" name="Version" access="read"/></interface>
<method name="SetLogging">
<arg type="s" name="level" direction="in"/>
</method>
<method name="ReportKernelEvent">
<arg type="a{sv}" name="properties" direction="in"/>
</method>
<method name="InhibitDevice">
<arg type="s" name="uid" direction="in"/>
<arg type="b" name="inhibit" direction="in"/>
</method>
<property type="s" name="Version" access="read"/>
</interface>
</node>
3 changes: 2 additions & 1 deletion src/bluez/horipad_steam/input_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ InputReader::~InputReader() {
stop();
}

// NOLINTNEXTLINE(readability-static-accessed-through-instance)
InputReader::Task InputReader::read_input() {
spdlog::debug("hidraw device: {}", device_);

Expand Down Expand Up @@ -137,7 +138,7 @@ InputReader::Task InputReader::read_input() {
close(fd);
stop();

co_return;
co_return; // NOLINT(readability-static-accessed-through-instance)
}

std::string InputReader::dpad_to_string(const Direction dpad) {
Expand Down
3 changes: 2 additions & 1 deletion src/bluez/ps5_dual_sense/input_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ InputReader::~InputReader() {
stop();
}

// NOLINTNEXTLINE(readability-static-accessed-through-instance)
InputReader::Task InputReader::read_input() {
spdlog::debug("hidraw device: {}", device_);

Expand Down Expand Up @@ -142,7 +143,7 @@ InputReader::Task InputReader::read_input() {
close(fd);
stop();

co_return;
co_return; // NOLINT(readability-static-accessed-through-instance)
}

int InputReader::GetControllerMacAll(const int fd,
Expand Down
3 changes: 2 additions & 1 deletion src/bluez/xbox_controller/input_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ InputReader::~InputReader() {
stop();
}

// NOLINTNEXTLINE(readability-static-accessed-through-instance)
InputReader::Task InputReader::read_input() {
spdlog::debug("hidraw device: {}", device_);

Expand Down Expand Up @@ -133,7 +134,7 @@ InputReader::Task InputReader::read_input() {
close(fd);
stop();

co_return;
co_return; // NOLINT(readability-static-accessed-through-instance)
}

std::string InputReader::dpad_to_string(const Direction dpad) {
Expand Down
5 changes: 3 additions & 2 deletions src/geoclue2/geoclue2_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

#include "../utils/utils.h"

GeoClue2Manager::GeoClue2Manager(sdbus::IConnection& connection,
LocationPropertiesChangedCallback callback)
GeoClue2Manager::GeoClue2Manager(
sdbus::IConnection& connection,
const LocationPropertiesChangedCallback& callback)
: ProxyInterfaces{connection, sdbus::ServiceName(kBusName),
sdbus::ObjectPath(kObjectPath)},
object_path_(sdbus::ObjectPath(kObjectPath)) {
Expand Down
2 changes: 1 addition & 1 deletion src/geoclue2/geoclue2_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GeoClue2Manager final

explicit GeoClue2Manager(
sdbus::IConnection& connection,
LocationPropertiesChangedCallback callback = nullptr);
const LocationPropertiesChangedCallback& callback = nullptr);

virtual ~GeoClue2Manager();

Expand Down
10 changes: 4 additions & 6 deletions src/login1/login1_manager_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#include "login1_manager_client.h"

#include <sys/socket.h>

#include "../utils/utils.h"

Login1ManagerClient::Login1ManagerClient(sdbus::IConnection& connection)
Expand All @@ -25,7 +23,7 @@ Login1ManagerClient::Login1ManagerClient(sdbus::IConnection& connection)
const auto props = this->GetAllAsync(
Manager_proxy::INTERFACE_NAME,
[&](std::optional<sdbus::Error> error,
std::map<sdbus::PropertyName, sdbus::Variant> values) {
const std::map<sdbus::PropertyName, sdbus::Variant>& values) {
if (!error) {
onPropertiesChanged(
sdbus::InterfaceName(Manager_proxy::INTERFACE_NAME), values, {});
Expand Down Expand Up @@ -60,19 +58,19 @@ Login1ManagerClient::Login1ManagerClient(sdbus::IConnection& connection)

Login1ManagerClient::~Login1ManagerClient() {
unregisterProxy();
for (const auto& [objectPath, seat] : seats_) {
for (const auto& objectPath : seats_ | std::views::keys) {
if (seats_.contains(objectPath)) {
seats_[objectPath].reset();
seats_.erase(objectPath);
}
}
for (const auto& [objectPath, session] : sessions_) {
for (const auto& objectPath : sessions_ | std::views::keys) {
if (sessions_.contains(objectPath)) {
sessions_[objectPath].reset();
sessions_.erase(objectPath);
}
}
for (const auto& [objectPath, seat] : users_) {
for (const auto& objectPath : users_ | std::views::keys) {
if (users_.contains(objectPath)) {
users_[objectPath].reset();
users_.erase(objectPath);
Expand Down
2 changes: 1 addition & 1 deletion src/network1/network1_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Network1ManagerClient::Network1ManagerClient(sdbus::IConnection& connection)
this->GetAllAsync(
Manager_proxy::INTERFACE_NAME,
[this](std::optional<sdbus::Error> error,
std::map<sdbus::PropertyName, sdbus::Variant> values) {
const std::map<sdbus::PropertyName, sdbus::Variant>& values) {
if (error) {
spdlog::warn("network1.Manager GetAllAsync failed: {} - {}",
error->getName(), error->getMessage());
Expand Down
18 changes: 8 additions & 10 deletions src/proxy/fi/w1/wpa_supplicant1/wpa_supplicant1_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/

#ifndef __sdbuscpp__src_proxy_fi_w1_wpa_supplicant1_wpa_supplicant1_proxy_h__proxy__H__
#define __sdbuscpp__src_proxy_fi_w1_wpa_supplicant1_wpa_supplicant1_proxy_h__proxy__H__
#ifndef _sdbuscpp_src_proxy_fi_w1_wpa_supplicant1_wpa_supplicant1_proxy_h_proxy_H_
#define _sdbuscpp_src_proxy_fi_w1_wpa_supplicant1_wpa_supplicant1_proxy_h_proxy_H_

#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>

namespace fi {
namespace w1 {
namespace fi::w1 {

class wpa_supplicant1_proxy {
public:
static constexpr const char* INTERFACE_NAME = "fi.w1.wpa_supplicant1";

protected:
wpa_supplicant1_proxy(sdbus::IProxy& proxy) : m_proxy(proxy) {}
static constexpr auto INTERFACE_NAME = "fi.w1.wpa_supplicant1";

wpa_supplicant1_proxy(const wpa_supplicant1_proxy&) = delete;
wpa_supplicant1_proxy& operator=(const wpa_supplicant1_proxy&) = delete;
wpa_supplicant1_proxy(wpa_supplicant1_proxy&&) = delete;
wpa_supplicant1_proxy& operator=(wpa_supplicant1_proxy&&) = delete;

protected:
explicit wpa_supplicant1_proxy(sdbus::IProxy& proxy) : m_proxy(proxy) {}

~wpa_supplicant1_proxy() = default;

void registerProxy() {
Expand Down Expand Up @@ -152,7 +151,6 @@ class wpa_supplicant1_proxy {
sdbus::IProxy& m_proxy;
};

} // namespace w1
} // namespace fi
} // namespace fi::w1

#endif
19 changes: 8 additions & 11 deletions src/proxy/org/bluez/Adapter1/adapter1_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,26 @@
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/

#ifndef __sdbuscpp__src_proxy_org_bluez_Adapter1_adapter1_proxy_h__proxy__H__
#define __sdbuscpp__src_proxy_org_bluez_Adapter1_adapter1_proxy_h__proxy__H__
#ifndef _sdbuscpp_src_proxy_org_bluez_Adapter1_adapter1_proxy_h_proxy_H_
#define _sdbuscpp_src_proxy_org_bluez_Adapter1_adapter1_proxy_h_proxy_H_

#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>

namespace org {
namespace bluez {
namespace org::bluez {

class Adapter1_proxy {
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.Adapter1";

protected:
Adapter1_proxy(sdbus::IProxy& proxy) : m_proxy(proxy) {}
static constexpr auto INTERFACE_NAME = "org.bluez.Adapter1";

Adapter1_proxy(const Adapter1_proxy&) = delete;
Adapter1_proxy& operator=(const Adapter1_proxy&) = delete;
Adapter1_proxy(Adapter1_proxy&&) = delete;
Adapter1_proxy& operator=(Adapter1_proxy&&) = delete;

protected:
explicit Adapter1_proxy(sdbus::IProxy& proxy) : m_proxy(proxy) {}

~Adapter1_proxy() = default;

void registerProxy() {}
Expand Down Expand Up @@ -178,7 +176,6 @@ class Adapter1_proxy {
sdbus::IProxy& m_proxy;
};

} // namespace bluez
} // namespace org
} // namespace org::bluez

#endif
19 changes: 8 additions & 11 deletions src/proxy/org/bluez/AgentManager/agent_manager1_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,26 @@
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/

#ifndef __sdbuscpp__src_proxy_org_bluez_AgentManager_agent_manager1_proxy_h__proxy__H__
#define __sdbuscpp__src_proxy_org_bluez_AgentManager_agent_manager1_proxy_h__proxy__H__
#ifndef _sdbuscpp_src_proxy_org_bluez_AgentManager_agent_manager1_proxy_h_proxy_H_
#define _sdbuscpp_src_proxy_org_bluez_AgentManager_agent_manager1_proxy_h_proxy_H_

#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>

namespace org {
namespace bluez {
namespace org::bluez {

class AgentManager1_proxy {
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.AgentManager1";

protected:
AgentManager1_proxy(sdbus::IProxy& proxy) : m_proxy(proxy) {}
static constexpr auto INTERFACE_NAME = "org.bluez.AgentManager1";

AgentManager1_proxy(const AgentManager1_proxy&) = delete;
AgentManager1_proxy& operator=(const AgentManager1_proxy&) = delete;
AgentManager1_proxy(AgentManager1_proxy&&) = delete;
AgentManager1_proxy& operator=(AgentManager1_proxy&&) = delete;

protected:
explicit AgentManager1_proxy(sdbus::IProxy& proxy) : m_proxy(proxy) {}

~AgentManager1_proxy() = default;

void registerProxy() {}
Expand Down Expand Up @@ -53,7 +51,6 @@ class AgentManager1_proxy {
sdbus::IProxy& m_proxy;
};

} // namespace bluez
} // namespace org
} // namespace org::bluez

#endif
Loading
Loading