From 80e814466b7bb6c36228334df0dbc08001c88df0 Mon Sep 17 00:00:00 2001 From: Divyanshu_Sharma Date: Sat, 4 Apr 2026 16:11:50 +0530 Subject: [PATCH] tools: fix cpplint false positive for v8::FastApiCallbackOptions& --- tools/cpplint.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/cpplint.py b/tools/cpplint.py index 464d95b8824f95..d7bf27e15f12fc 100755 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -6573,6 +6573,12 @@ def CheckForNonConstReference(filename, clean_lines, linenum, nesting_state, err r"static_assert|COMPILE_ASSERT" r")\s*\(" ) + + # V8 Fast API types require non-const references as part of their API + # contract; Node.js has no control over these signatures. + _V8_FAST_API_REF_TYPES = re.compile( + r"v8::FastApiCallbackOptions\s*&" + ) if re.search(allowed_functions, line): return if not re.search(r"\S+\([^)]*$", line): @@ -6587,7 +6593,7 @@ def CheckForNonConstReference(filename, clean_lines, linenum, nesting_state, err for parameter in re.findall(_RE_PATTERN_REF_PARAM, decls): if not re.match(_RE_PATTERN_CONST_REF_PARAM, parameter) and not re.match( _RE_PATTERN_REF_STREAM_PARAM, parameter - ): + ) and not _V8_FAST_API_REF_TYPES.search(parameter): error( filename, linenum,