tools: check for std::vector<v8::Local> in lint

PR-URL: https://github.com/nodejs/node/pull/58497
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
Aditi 2025-08-01 21:25:30 +05:30 committed by GitHub
parent 5794e644b7
commit c7d7ec7cda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

15
tools/cpplint.py vendored
View file

@ -6475,6 +6475,19 @@ def CheckItemIndentationInNamespace(filename, raw_lines_no_comments, linenum,
error(filename, linenum, 'runtime/indentation_namespace', 4,
'Do not indent within a namespace')
def CheckLocalVectorUsage(filename, lines, error):
"""Logs an error if std::vector<v8::Local<T>> is used.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found.
"""
for linenum, line in enumerate(lines):
if (Search(r'\bstd::vector<v8::Local<[^>]+>>', line) or
Search(r'\bstd::vector<Local<[^>]+>>', line)):
error(filename, linenum, 'runtime/local_vector', 5,
'Do not use std::vector<v8::Local<T>>. '
'Use v8::LocalVector<T> instead.')
def ProcessLine(filename, file_extension, clean_lines, line,
include_state, function_state, nesting_state, error,
@ -6645,6 +6658,8 @@ def ProcessFileData(filename, file_extension, lines, error,
CheckInlineHeader(filename, include_state, error)
CheckLocalVectorUsage(filename, lines, error)
def ProcessConfigOverrides(filename):
""" Loads the configuration files and processes the config overrides.