chore: formatter & clangd lsp option
C++ / fmt (pull_request) Successful in 5s
C++ / build (pull_request) Failing after 10s
C++ / clang-tidy (pull_request) Failing after 10s
JS/TS / fmt (pull_request) Successful in 7s
JS/TS / lint (pull_request) Successful in 9s
Python / static (pull_request) Successful in 27s
Rust / build (pull_request) Successful in 50s
Python / verify (pull_request) Successful in 1m40s
Rust / fmt (pull_request) Successful in 28s
Rust / clippy (pull_request) Successful in 45s

This commit is contained in:
2026-10-18 15:23:40 +02:00
parent 45aa6c9005
commit 08d42e1f8a
15 changed files with 73 additions and 78 deletions
+5
View File
@@ -0,0 +1,5 @@
CompileFlags:
Remove:
# GCC-only flags from the system's default spec that clang/clangd cannot
# parse. They appear in compile_commands.json but are not set by the project.
- -mno-direct-extern-access
+11 -2
View File
@@ -61,10 +61,12 @@ set(CMAKE_INSTALL_MESSAGE NEVER)
add_compile_options(
-Wall -Wextra -Wpedantic -Wshadow -Wconversion
-Wold-style-cast -Wnull-dereference -Wdouble-promotion
-Wformat=2 -Wfloat-equal -Woverloaded-virtual
-Wnull-dereference -Wdouble-promotion
-Wformat=2 -Wfloat-equal
-Wsign-conversion -Wredundant-decls -Wswitch
-Wunreachable-code
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast>
$<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual>
)
@@ -188,4 +190,11 @@ if("m3shapes" IN_LIST ENABLE_MODULES)
if(TARGET m3shapesplugin)
set_target_properties(m3shapesplugin PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
# Silence warnings that come from m3shapes files we do not manage.
foreach(m3shapes_target m3shapes_core m3shapes_morph m3shapes_shapes m3shapes m3shapesplugin)
if(TARGET ${m3shapes_target})
target_compile_options(${m3shapes_target} PRIVATE -Wno-shadow -Wno-float-equal)
endif()
endforeach()
endif()
+3 -7
View File
@@ -50,9 +50,9 @@ class BlobRect : public BlobShape {
[[nodiscard]] qreal damping() const { return m_damping; }
void setDamping(qreal d) {
if (!qFuzzyCompare(m_damping, d)) {
m_damping = d;
void setDamping(qreal value) {
if (!qFuzzyCompare(m_damping, value)) {
m_damping = value;
emit dampingChanged();
}
}
@@ -110,7 +110,6 @@ class BlobRect : public BlobShape {
void checkAtRest(float speed);
void beginRetire();
// Physics state
QPointF m_prevScenePos;
QElapsedTimer m_elapsed;
bool m_physicsActive = false;
@@ -122,13 +121,10 @@ class BlobRect : public BlobShape {
float m_retire01 = 0.0f;
float m_retire11 = 1.0f;
// Symmetric 2x2 deformation matrix components (3 independent: m00, m01,
// m11) Rest state is identity: m00=1, m01=0, m11=1
float m_dm00 = 1.0f;
float m_dm01 = 0.0f;
float m_dm11 = 1.0f;
// Spring velocities for each component
float m_dmVel00 = 0.0f;
float m_dmVel01 = 0.0f;
float m_dmVel11 = 0.0f;
+6 -10
View File
@@ -168,10 +168,6 @@ void BlobShape::updatePolish() {
if (other->width() <= 0 || other->height() <= 0) continue;
// Excluded shapes stay in the rect data. Exclusion only gates the smooth
// blend (via excludeMask below); ownership must still see every shape,
// otherwise two nodes can both believe they own a pixel and the pixel is
// blended twice.
const QPointF otherScene = other->mapToScene(QPointF(0, 0));
bool include = false;
@@ -196,7 +192,7 @@ void BlobShape::updatePolish() {
const QMatrix4x4& dm = other->m_deformMatrix;
const float a = dm(0, 0), b = dm(1, 0);
const float c = dm(0, 1), d = dm(1, 1);
const float c = dm(0, 1), e = dm(1, 1);
BlobRectData r;
r.cx = static_cast<float>(otherScene.x() + other->width() / 2.0);
@@ -207,19 +203,19 @@ void BlobShape::updatePolish() {
r.offsetX = dm(0, 3);
r.offsetY = dm(1, 3);
const float det = a * d - c * b;
const float det = a * e - c * b;
const float invDet = std::abs(det) > 1e-6f ? 1.0f / det : 1.0f;
r.invDeform[0] = d * invDet;
r.invDeform[0] = e * invDet;
r.invDeform[1] = -b * invDet;
r.invDeform[2] = -c * invDet;
r.invDeform[3] = a * invDet;
const float halfTr = 0.5f * (a + d);
const float halfDiff = 0.5f * (a - d);
const float halfTr = 0.5f * (a + e);
const float halfDiff = 0.5f * (a - e);
r.minEig = halfTr - std::sqrt(halfDiff * halfDiff + c * c);
r.screenHalfX = std::abs(a) * r.hw + std::abs(c) * r.hh;
r.screenHalfY = std::abs(b) * r.hw + std::abs(d) * r.hh;
r.screenHalfY = std::abs(b) * r.hw + std::abs(e) * r.hh;
m_cachedRects.append(r);
rectShapes.append(other);
+11 -11
View File
@@ -187,7 +187,7 @@ void CarouselView::setModel(const QVariantList& m) {
emit modelChanged();
const int newCount = m_model.size();
const int newCount = static_cast<int>(m_model.size());
if (newCount == 0) {
m_currentRealIndex = -1;
@@ -647,7 +647,7 @@ qreal CarouselView::sampleSize(qreal childLoc) const {
}
int CarouselView::realIndexOf(int virtualIndex) const {
const int count = m_model.size();
const int count = static_cast<int>(m_model.size());
if (count == 0) return -1;
@@ -668,7 +668,7 @@ qreal CarouselView::snapTargetX(qreal x) const {
}
void CarouselView::wrapContentIfNeeded() {
const int count = m_model.size();
const int count = static_cast<int>(m_model.size());
if (count == 0) return;
@@ -707,7 +707,7 @@ void CarouselView::wrapContentIfNeeded() {
}
void CarouselView::updateCurrentIndexFromContentX(bool emitPreview) {
const int count = m_model.size();
const int count = static_cast<int>(m_model.size());
if (count == 0) return;
@@ -856,8 +856,8 @@ void CarouselView::positionSlot(const Slot& slot) const {
return rightIndex == n ? m_arrangement.outerSpacing : m_itemSpacing;
};
const auto leftGap = [this, n](int leftIndex) {
return leftIndex == -n ? m_arrangement.outerSpacing : m_itemSpacing;
const auto leftGap = [this, n](int gapIndex) {
return gapIndex == -n ? m_arrangement.outerSpacing : m_itemSpacing;
};
qreal center = 0;
@@ -974,7 +974,7 @@ void CarouselView::releaseAllItems() {
}
void CarouselView::relayout() {
const int count = m_model.size();
const int count = static_cast<int>(m_model.size());
if (count == 0 || width() <= 0 || m_focalWidth <= 0) {
for (Slot& s : m_slots) {
@@ -1038,7 +1038,7 @@ void CarouselView::relayout() {
m_slots.append(Slot{});
slotUsedThisPass.append(false);
freeSlot = m_slots.size() - 1;
freeSlot = static_cast<int>(m_slots.size()) - 1;
}
updateSlotContent(m_slots[freeSlot], v);
@@ -1092,7 +1092,7 @@ void CarouselView::snapToNearest() {
}
void CarouselView::goToIndex(int realIndex) {
const int count = m_model.size();
const int count = static_cast<int>(m_model.size());
if (count == 0) return;
@@ -1126,7 +1126,7 @@ void CarouselView::decrementCurrentIndex() {
}
void CarouselView::centerInstantlyOnReal(int realIndex) {
const int count = m_model.size();
const int count = static_cast<int>(m_model.size());
if (count == 0) return;
@@ -1220,7 +1220,7 @@ qreal CarouselView::sampledVelocity() const {
const VelocitySample& oldest = m_velocitySamples.first();
const VelocitySample& newest = m_velocitySamples.last();
const qreal dt = newest.t - oldest.t;
const qreal dt = static_cast<qreal>(newest.t - oldest.t);
if (dt < 8) return 0;
@@ -252,8 +252,6 @@ int ChatListView::count() const {
}
bool ChatListView::event(QEvent* e) {
// qDebug() << "ChatListView::event() runs";
return QQuickItem::event(e);
}
@@ -366,7 +364,6 @@ void ChatListView::updatePolish() {
m_animateY = false;
const int layoutSize = static_cast<int>(m_layout.size());
const qint64 now = m_clock.elapsed();
bool wrote = false;
for (auto& entry : m_delegates) {
if (!entry.item || entry.pendingRemoval || entry.pendingInsert)
continue;
@@ -397,7 +394,6 @@ void ChatListView::updatePolish() {
entry.item->setY(target);
entry.hasPropY = false;
}
wrote = true;
}
applyAnchor();
@@ -50,8 +50,6 @@ void SparklineContent::setLine2(internal::CircularBuffer* buffer) {
void SparklineContent::connectBuffer(internal::CircularBuffer* buffer) {
if (!buffer) return;
// New data, or the buffer's own smoothingRadius changed (it re-emits
// valuesChanged in that case too) -> geometry is stale.
connect(
buffer,
&internal::CircularBuffer::valuesChanged,
@@ -67,7 +65,7 @@ void SparklineContent::connectBuffer(internal::CircularBuffer* buffer) {
void SparklineContent::setLine1Color(const QColor& color) {
if (m_line1Color == color) return;
m_line1Color = color;
update(); // visual-only, no geometry rebuild needed
update();
}
void SparklineContent::setLine2Color(const QColor& color) {
@@ -173,7 +171,7 @@ SparklineContent::LineGeometry SparklineContent::buildGeometry(
if (m_curveSmoothing && points.size() > 2) {
const qreal tension = 1.0;
const qreal k = tension / 6.0;
const int n = points.size();
const int n = static_cast<int>(points.size());
for (int i = 0; i < n - 1; ++i) {
const QPointF& p0 = points[qMax(i - 1, 0)];
@@ -84,7 +84,6 @@ SparklineSceneItem::LineSample SparklineSceneItem::buildSample(
points.reserve(len);
for (int i = 0; i < len; ++i) {
// Already smoothed once, incrementally, by the buffer itself.
const qreal value =
qBound<qreal>(0.0, buffer->smoothedAt(i), m_maxValue);
@@ -99,7 +98,7 @@ SparklineSceneItem::LineSample SparklineSceneItem::buildSample(
if (m_curveSmoothing && points.size() > 2) {
const qreal tension = 1.0;
const qreal k = tension / 6.0;
const int n = points.size();
const int n = static_cast<int>(points.size());
for (int i = 0; i < n - 1; ++i) {
const QPointF& p0 = points[qMax(i - 1, 0)];
const QPointF& p1 = points[i];
@@ -125,9 +124,6 @@ SparklineSceneItem::LineSample SparklineSceneItem::buildSample(
}
}
// Flatten the curve to a polyline once, here, on data change only.
// This is CPU math only -- no QPainter draw calls, no image, no
// texture upload happen as a result of this.
const auto subpaths = path.toSubpathPolygons();
if (subpaths.isEmpty()) return sample;
@@ -139,7 +135,7 @@ SparklineSceneItem::LineSample SparklineSceneItem::buildSample(
void SparklineSceneItem::writeFillGeometry(
QSGGeometryNode* node, const LineSample& sample) {
const int n = sample.polyline.size();
const int n = static_cast<int>(sample.polyline.size());
auto* geometry = node->geometry();
geometry->allocate(n * 2);
geometry->setDrawingMode(QSGGeometry::DrawTriangleStrip);
@@ -147,8 +143,10 @@ void SparklineSceneItem::writeFillGeometry(
auto* vertices = geometry->vertexDataAsPoint2D();
for (int i = 0; i < n; ++i) {
const QPointF& p = sample.polyline[i];
vertices[i * 2].set(p.x(), p.y());
vertices[i * 2 + 1].set(p.x(), sample.fillBottom);
vertices[i * 2].set(
static_cast<float>(p.x()), static_cast<float>(p.y()));
vertices[i * 2 + 1].set(
static_cast<float>(p.x()), static_cast<float>(sample.fillBottom));
}
node->markDirty(QSGNode::DirtyGeometry);
@@ -156,7 +154,7 @@ void SparklineSceneItem::writeFillGeometry(
void SparklineSceneItem::writeStrokeGeometry(
QSGGeometryNode* node, const LineSample& sample, qreal lineWidth) {
const int n = sample.polyline.size();
const int n = static_cast<int>(sample.polyline.size());
auto* geometry = node->geometry();
geometry->allocate(n * 2);
geometry->setDrawingMode(QSGGeometry::DrawTriangleStrip);
@@ -179,8 +177,12 @@ void SparklineSceneItem::writeStrokeGeometry(
const QPointF& p = sample.polyline[i];
const QPointF offset = normal * half;
vertices[i * 2].set(p.x() + offset.x(), p.y() + offset.y());
vertices[i * 2 + 1].set(p.x() - offset.x(), p.y() - offset.y());
vertices[i * 2].set(
static_cast<float>(p.x() + offset.x()),
static_cast<float>(p.y() + offset.y()));
vertices[i * 2 + 1].set(
static_cast<float>(p.x() - offset.x()),
static_cast<float>(p.y() - offset.y()));
}
node->markDirty(QSGNode::DirtyGeometry);
@@ -243,7 +245,7 @@ QSGNode* SparklineSceneItem::updatePaintNode(
}
QMatrix4x4 matrix;
matrix.translate(-stepX() * m_slideProgress, 0);
matrix.translate(static_cast<float>(-stepX() * m_slideProgress), 0.0f);
transformNode->setMatrix(matrix);
const bool needsGeometryWrite = samplesRebuilt || justCreated;
+1 -1
View File
@@ -85,7 +85,7 @@ class WavyLine : public QCanvasPainterItem {
[[nodiscard]] qreal value() const;
void setValue(qreal value);
signals:
signals:
void lineWidthChanged();
void amplitudeMultiplierChanged();
void frequencyChanged();
+8 -16
View File
@@ -37,12 +37,10 @@ static std::filesystem::path g_runtimeDir{"/tmp"};
static std::filesystem::path g_cacheBase{"/tmp/.cache"};
static void initEnvPaths() {
if (const char* env = getenv("XDG_RUNTIME_DIR"))
g_runtimeDir = env;
if (const char* env = getenv("XDG_RUNTIME_DIR")) g_runtimeDir = env;
if (const char* env = getenv("XDG_CACHE_HOME")) {
if (*env)
g_cacheBase = env;
if (*env) g_cacheBase = env;
} else if (const char* home = getenv("HOME")) {
g_cacheBase = std::filesystem::path(home) / ".cache";
}
@@ -50,8 +48,7 @@ static void initEnvPaths() {
static std::ofstream& debugLog() {
static std::ofstream log(
g_runtimeDir / "zshell-nightlight-debug.log",
std::ios::app);
g_runtimeDir / "zshell-nightlight-debug.log", std::ios::app);
return log;
}
@@ -173,8 +170,7 @@ static bool hkSaveBufferForMirror(CHyprOpenGLImpl* thisptr, const CBox& box) {
static void installShader() {
auto* gl = g_pHyprOpenGL.get();
if (!gl)
return;
if (!gl) return;
ensureShaderFile(shaderPath(), defaultShaderSource());
gl->applyScreenShader(shaderPath().string());
@@ -196,8 +192,7 @@ static void installShader() {
static void setUniformGain(const std::array<float, 3>& gain) {
auto* gl = g_pHyprOpenGL.get();
auto* shader = gl ? gl->m_finalScreenShader.get() : nullptr;
if (!gl || !shader)
return;
if (!gl || !shader) return;
gl->useShader(gl->m_finalScreenShader);
shader->setUniformFloat3(SHADER_TINT, gain[0], gain[1], gain[2]);
@@ -214,8 +209,7 @@ static void hkBegin(
if (fb) {
auto* renderer = g_pHyprRenderer.get();
if (renderer)
renderer->m_renderData.blockScreenShader = true;
if (renderer) renderer->m_renderData.blockScreenShader = true;
}
if (!g_active) return;
@@ -223,8 +217,7 @@ static void hkBegin(
auto* gl = g_pHyprOpenGL.get();
if (!gl) return;
if (gl->m_finalScreenShader.get() &&
gl->m_finalScreenShader->program() < 1)
if (gl->m_finalScreenShader.get() && gl->m_finalScreenShader->program() < 1)
installShader();
if (!gl->m_finalScreenShader.get() ||
gl->m_finalScreenShader->program() < 1)
@@ -232,8 +225,7 @@ static void hkBegin(
if (g_transition.active) {
auto* monPtr = mon.get();
if (!monPtr)
return;
if (!monPtr) return;
const float elapsed =
std::chrono::duration<float>(
std::chrono::steady_clock::now() - g_transition.start)
+4 -4
View File
@@ -182,10 +182,10 @@ static QString buildHlConfigCall(const QString& key, const QVariant& value) {
}
static QColor colorFromInt(quint32 value) {
const int a = (value >> 24) & 0xFF;
const int r = (value >> 16) & 0xFF;
const int g = (value >> 8) & 0xFF;
const int b = value & 0xFF;
const int a = static_cast<int>(value >> 24) & 0xFF;
const int r = static_cast<int>(value >> 16) & 0xFF;
const int g = static_cast<int>(value >> 8) & 0xFF;
const int b = static_cast<int>(value) & 0xFF;
return QColor(r, g, b, a);
}
+1 -1
View File
@@ -72,7 +72,7 @@ static QCanvasPath buildStrokePath(
void StrokeCanvasItem::undoLastGroup() {
if (m_strokes.isEmpty()) return;
const int lastGroup = m_strokes.last().groupId;
for (int i = m_strokes.size() - 1;
for (int i = static_cast<int>(m_strokes.size()) - 1;
i >= 0 && m_strokes[i].groupId == lastGroup;
--i)
m_strokes.remove(i);
@@ -154,7 +154,7 @@ void StrokeCanvasRenderer::synchronizeData(QCanvasPainterItem* item) {
for (const auto& stroke : canvas->m_strokes)
canvasGroupIds.insert(stroke.groupId);
for (int i = m_strokes.size() - 1; i >= 0; --i) {
for (int i = static_cast<int>(m_strokes.size()) - 1; i >= 0; --i) {
if (!canvasGroupIds.contains(m_strokes[i].groupId)) {
if (m_strokes[i].groupId >= 0)
m_pendingGroupRemovals.append(m_strokes[i].groupId);
+1 -1
View File
@@ -119,7 +119,7 @@ void FileReadTool::execute(
return;
}
const QString head = content.left(limit);
const int nextOffset = offset + head.toUtf8().size();
const int nextOffset = offset + static_cast<int>(head.toUtf8().size());
const QString output =
head +
QStringLiteral(
+1
View File
@@ -1,4 +1,5 @@
add_library(zshell-pch INTERFACE)
target_compile_options(zshell-pch INTERFACE $<$<COMPILE_LANGUAGE:CXX>:-Wno-null-dereference>)
target_precompile_headers(zshell-pch INTERFACE
<qobject.h>
<qqmlintegration.h>