From 9b003c0ae81b3f55f4be1d9798273d9e56713cc0 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sun, 12 Apr 2026 21:16:06 +0200 Subject: [PATCH] Fix pre-commit OOM: batch cppcheck, cap Node heap, fail-fast - cppcheck: process files one-at-a-time (xargs -n 1) + --check-level=normal - eslint: cap Node.js heap to 512MB via NODE_OPTIONS - Set fail_fast: true to avoid stacking memory-heavy hooks - Remove ulimit -v (ineffective with Linux memory overcommit) --- .pre-commit-config.yaml | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 201e560..bb35dce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,8 +11,8 @@ default_language_version: python: python3 -# Fail fast on first error (set to false to see all errors) -fail_fast: false +# Fail fast on first error — also prevents stacking memory-heavy hooks +fail_fast: true # Configuration ci: @@ -337,22 +337,10 @@ repos: hooks: - id: cppcheck name: cppcheck - entry: bash -c 'ulimit -v 3145728; exec cppcheck "$@"' -- + entry: bash -c 'printf "%s\0" "$@" | xargs -0 -n 1 cppcheck --enable=warning,portability --check-level=normal --quiet --error-exitcode=1 --inline-suppr --suppress=missingIncludeSystem --suppress=syntaxError --suppress=nullPointerOutOfResources --suppress=ctunullpointerOutOfResources --suppress=ctunullpointerOutOfMemory --std=c11' -- language: system types_or: [c, c++] exclude: ^(pomodoro_app/|horatio/) - args: - - --enable=warning,portability - - --check-level=normal - - --quiet - - --error-exitcode=1 - - --inline-suppr - - --suppress=missingIncludeSystem - - --suppress=syntaxError - - --suppress=nullPointerOutOfResources - - --suppress=ctunullpointerOutOfResources - - --suppress=ctunullpointerOutOfMemory - - --std=c11 # =========================================================================== # FLAWFINDER - C/C++ security scanner @@ -376,7 +364,7 @@ repos: hooks: - id: eslint name: eslint - entry: npx eslint --no-warn-ignored + entry: bash -c 'NODE_OPTIONS="--max-old-space-size=512" npx eslint --no-warn-ignored "$@"' -- language: system types_or: [ts, tsx] files: ^TS/