mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 05:38:47 +02:00
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:
parent
5794e644b7
commit
c7d7ec7cda
1 changed files with 15 additions and 0 deletions
15
tools/cpplint.py
vendored
15
tools/cpplint.py
vendored
|
@ -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.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue