Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tools/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.

Expand Down
Loading