Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Fix 10 mechanical NOLINTNEXTLINE suppressions (Phase 4)

Martin Vogelbdfdda67c438
diff --git a/.clang-tidy b/.clang-tidy
index dbfe04ec8..92da175c0 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -50,6 +50,7 @@ Checks: >
-clang-analyzer-unix.Malloc,
-misc-include-cleaner,
-bugprone-command-processor,
+ -bugprone-suspicious-include,
-cert-env33-c,
-bugprone-easily-swappable-parameters,
-concurrency-mt-unsafe,
diff --git a/internal/cbm/lz4_store.c b/internal/cbm/lz4_store.c
index a5f766c4e..787472533 100644
--- a/internal/cbm/lz4_store.c
+++ b/internal/cbm/lz4_store.c
@@ -1,12 +1,8 @@
-// lz4_store.c — Thin C wrappers around LZ4 HC for the sourceStore.
-// Linked via CGo from lz4.go.
+// lz4_store.c — Thin C wrappers around LZ4 HC.
+// Include vendored LZ4 source directly — compiled as a single translation unit.
-// Include the vendored LZ4 source directly so CGo compiles everything
-// in a single translation unit (avoids separate .c file compilation issues).
-// NOLINTNEXTLINE(bugprone-suspicious-include)
-#include "vendored/lz4/lz4.c"
-// NOLINTNEXTLINE(bugprone-suspicious-include)
-#include "vendored/lz4/lz4hc.c"
+#include "vendored/lz4/lz4.c" // unity build: vendored source
+#include "vendored/lz4/lz4hc.c" // unity build: vendored source
#include "lz4_store.h"
diff --git a/internal/cbm/sqlite_writer.c b/internal/cbm/sqlite_writer.c
index a94f21f83..83fbc1493 100644
--- a/internal/cbm/sqlite_writer.c
+++ b/internal/cbm/sqlite_writer.c
@@ -800,9 +800,8 @@ static uint8_t *build_index_entry_unique_2int_text_rowid(int64_t v1, int64_t v2,
return NULL;
}
- // NOLINTNEXTLINE(misc-confusable-identifiers) — identifiers are distinct in context
- int vl = varint_len(payload_len);
- int total = vl + payload_len;
+ int vlen = varint_len(payload_len);
+ int total = vlen + payload_len;
uint8_t *cell = (uint8_t *)malloc(total);
if (!cell) {
free(payload);
diff --git a/src/cli/cli.c b/src/cli/cli.c
index f5652d1f2..a2da36d8e 100644
--- a/src/cli/cli.c
+++ b/src/cli/cli.c
@@ -1087,7 +1087,11 @@ int cbm_upsert_instructions(const char *path, const char *content) {
} else {
/* Append section */
size_t new_len = existing_len + 1 + strlen(section);
- // NOLINTNEXTLINE(clang-analyzer-optin.taint.TaintedAlloc)
+ if (new_len > 10 * 1024 * 1024) { /* 10 MB safety cap */
+ free(existing);
+ free(section);
+ return -1;
+ }
result = malloc(new_len + 1);
if (!result) {
free(existing);
diff --git a/src/foundation/compat_fs.c b/src/foundation/compat_fs.c
index cd2073c01..981404624 100644
--- a/src/foundation/compat_fs.c
+++ b/src/foundation/compat_fs.c
@@ -217,7 +217,6 @@ void cbm_closedir(cbm_dir_t *d) {
}
FILE *cbm_popen(const char *cmd, const char *mode) {
- // NOLINTNEXTLINE(cert-env33-c) — popen needed for git commands
return popen(cmd, mode);
}
diff --git a/src/pipeline/pass_infrascan.c b/src/pipeline/pass_infrascan.c
index fa5249e6b..58a2a43f2 100644
--- a/src/pipeline/pass_infrascan.c
+++ b/src/pipeline/pass_infrascan.c
@@ -250,32 +250,32 @@ bool cbm_is_secret_value(const char *value) {
const char *p;
/* AKIA + 16 alnum (AWS key) */
- // NOLINTNEXTLINE(bugprone-assignment-in-if-condition)
- if ((p = ci_strstr(value, "AKIA")) && count_alnum(p + 4) >= 16) {
+ p = ci_strstr(value, "AKIA");
+ if (p && count_alnum(p + 4) >= 16) {
return true;
}
/* sk- + 20 alnum (API key) */
- // NOLINTNEXTLINE(bugprone-assignment-in-if-condition)
- if ((p = ci_strstr(value, "sk-")) && count_alnum(p + 3) >= 20) {
+ p = ci_strstr(value, "sk-");
+ if (p && count_alnum(p + 3) >= 20) {
return true;
}
/* ghp_ + 36 alnum (GitHub PAT) */
- // NOLINTNEXTLINE(bugprone-assignment-in-if-condition)
- if ((p = ci_strstr(value, "ghp_")) && count_alnum(p + 4) >= GITHUB_PAT_MIN_ALNUM) {
+ p = ci_strstr(value, "ghp_");
+ if (p && count_alnum(p + 4) >= GITHUB_PAT_MIN_ALNUM) {
return true;
}
/* glpat- + 20 alnum/dash (GitLab PAT) */
- // NOLINTNEXTLINE(bugprone-assignment-in-if-condition)
- if ((p = ci_strstr(value, "glpat-")) && count_alnum_dash(p + 6) >= 20) {
+ p = ci_strstr(value, "glpat-");
+ if (p && count_alnum_dash(p + 6) >= 20) {
return true;
}
/* xox[bps]- (Slack token) */
- // NOLINTNEXTLINE(bugprone-assignment-in-if-condition)
- if ((p = ci_strstr(value, "xox")) && p[3] &&
+ p = ci_strstr(value, "xox");
+ if (p && p[3] != '\0' &&
(tolower((unsigned char)p[3]) == 'b' || tolower((unsigned char)p[3]) == 'p' ||
tolower((unsigned char)p[3]) == 's') &&
p[4] == '-' && count_alnum_dash(p + 5) >= 1) {