Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
095cef2
deps: update ICU to 68.1
targos Nov 20, 2020
cfc8ec1
src: fix label indentation
Trott Nov 21, 2020
03e8aaf
tools: bump cpplint.py to 1.5.2
Trott Nov 21, 2020
cfadd82
tools: refloat 7 Node.js patches to cpplint.py
Trott Oct 9, 2020
47397ff
src: update node.rc file description
devsnek Nov 20, 2020
186ad24
doc: cleanup events.md structure
jasnell Nov 12, 2020
dc19309
events: graduate Event, EventTarget, AbortController
jasnell Nov 3, 2020
fdf5d85
doc: add missing version to update cmd
ruyadorno Nov 20, 2020
44c4aad
doc: stabilize subpath patterns
guybedford Nov 19, 2020
c86c239
tools: update ESLint to 7.14.0
cjihrig Nov 21, 2020
be11976
tools: enable no-nonoctal-decimal-escape lint rule
cjihrig Nov 21, 2020
b176d61
doc: fix --experimental-wasm-modules text location
cjihrig Nov 21, 2020
44d6d0b
test: fix missed warning for non-experimental AbortController
jasnell Nov 23, 2020
69a8f05
test: improve test coverage SourceMap API
juanarbol Nov 11, 2020
39d0ced
process: refactor to use more primordials
aduh95 Nov 15, 2020
841e8f4
crypto: fix "Invalid JWK" error messages
panva Nov 20, 2020
617cb58
lib: refactor primordials.uncurryThis
aduh95 Nov 21, 2020
d29199e
quic: refactor to use more primordials
aduh95 Nov 15, 2020
03cf8db
doc: fix typo in events.md
lpinca Nov 22, 2020
66bc206
deps: V8: cherry-pick 86991d0587a1
Nov 25, 2020
65d89fd
doc: adding example to Buffer.isBuffer method
ntedgi Nov 23, 2020
2344e3e
benchmark : changed `fstat` to `fstatSync`
Narasimha1997 Nov 21, 2020
b613950
test: increase coverage for util.inspect()
Trott Nov 22, 2020
bcf7393
tools: bump cpplint to 1.5.3
Trott Nov 23, 2020
82c1e39
tools: refloat 7 Node.js patches to cpplint.py
Trott Oct 9, 2020
a2da7ba
tools: use using-declaration consistently
danbev Nov 24, 2020
2c7358e
test: fix flaky sequential/test-fs-watch
Trott Nov 24, 2020
e79bdc3
assert: refactor to use more primordials
aduh95 Nov 19, 2020
74adc44
build: fix typo in Makefile
RaisinTen Nov 19, 2020
a9ac86d
policy: refactor to use more primordials
aduh95 Nov 15, 2020
c04a2df
fs: refactor to use more primordials
aduh95 Nov 19, 2020
744b8aa
fs: pass ERR_DIR_CLOSED asynchronously to dir.close
Lxxyx Nov 24, 2020
3e5fcda
doc: add table header in intl.md
Trott Nov 25, 2020
5935ccc
tools: fix undeclared identifier FALSE
aduh95 Nov 25, 2020
6bc007f
tty: refactor to use more primordials
Lxxyx Nov 26, 2020
537e5cb
fs: move method definition from header
yashLadha Nov 25, 2020
b61ca1b
test: replace anonymous functions by arrows
Nov 14, 2020
d95ae65
tools: update highlight.js to 10.1.2
MylesBorins Nov 28, 2020
58abdca
http: enable call chaining with setHeader()
PoojaDurgad Nov 2, 2020
278862a
deps: upgrade npm to 7.0.15
ruyadorno Nov 27, 2020
d4de7c7
module: add isPreloading indicator
jasnell Nov 25, 2020
0401ffb
doc: add process for handling premature disclosure
mhdawson Nov 17, 2020
8cf1add
tools: update stability index linking logic
Trott Nov 26, 2020
6ebb98a
src: use ToLocal in DeserializeProperties
danbev Nov 26, 2020
ea09da4
test: fix typo in comment
inokawa Nov 29, 2020
2a24096
os: refactor to use more primordials
aduh95 Nov 20, 2020
fbd5652
v8: refactor to use more primordials
aduh95 Nov 20, 2020
ea46ca8
perf_hooks: refactor to use more primordials
aduh95 Nov 21, 2020
5f41f1b
http2: check write not scheduled in scope destructor
davedoesdev Nov 23, 2020
c14512b
errors: display original symbol name
Nov 8, 2020
802d44b
worker: add experimental BroadcastChannel
jasnell Nov 26, 2020
8d8d226
buffer: refactor to use more primordials
aduh95 Nov 18, 2020
4127eb2
https: add abortcontroller test
benjamingr Nov 28, 2020
29b5236
timers: reject with AbortError on cancellation
benjamingr Nov 29, 2020
f317bba
tls: permit null as a cipher value
Trott Nov 29, 2020
855a85c
events: support signal in EventTarget
benjamingr Nov 25, 2020
faca2b8
test: fix test-worker-broadcastchannel-wpt
Trott Dec 2, 2020
9cb53f6
repl: refactor to use more primordials
aduh95 Nov 16, 2020
b20409e
tls: refactor to use more primordials
aduh95 Nov 17, 2020
21c4704
worker: refactor to use more primordials
aduh95 Nov 16, 2020
0e7f0c6
path: refactor to use more primordials
aduh95 Nov 18, 2020
ca8db41
benchmark,child_process: remove failing benchmark parameter
aduh95 Nov 27, 2020
e7b2d91
src: use transferred consistently
danbev Dec 1, 2020
ab084c1
querystring: refactor to use more primordials
aduh95 Nov 18, 2020
4ca1bd8
child_process: refactor to use more primordials
Lxxyx Nov 25, 2020
a03aa0a
src: rename AliasedBufferInfo->AliasedBufferIndex
danbev Dec 1, 2020
8dadaa6
src: remove some duplication in DeserializeProps
danbev Dec 1, 2020
cc18907
module: refactor to use more primordials
aduh95 Nov 21, 2020
4b4caad
zlib: refactor to use more primordials
aduh95 Nov 20, 2020
22028aa
test: skip flaky parts of broadcastchannel test on Windows
Trott Dec 4, 2020
8d69d83
dgram: refactor to use more primordials
aduh95 Nov 19, 2020
b885409
readline: refactor to use more primordials
aduh95 Nov 15, 2020
2868ffb
tools: remove bashisms from release script
aduh95 Nov 14, 2020
754b7a7
tools: remove bashisms from macOS release scripts
aduh95 Nov 14, 2020
6033d30
stream: add FileHandle support to Read/WriteStream
mmomtchev Nov 2, 2020
8731a80
vm: add `SafeForTerminationScope`s for SIGINT interruptions
addaleax Dec 1, 2020
a8b95cf
tools: bump cpplint to 1.5.4
Trott Nov 30, 2020
e798770
tools: refloat 7 Node.js patches to cpplint.py
Trott Oct 9, 2020
224a647
child_process: add AbortSignal support
benjamingr Nov 28, 2020
2649c38
doc: add version metadata to timers/promises
cjihrig Dec 4, 2020
bef550a
doc: add Powershell oneliner to get Windows version
saitonakamura Nov 6, 2019
fbcb72a
test: increase coverage for readline
Lxxyx Dec 4, 2020
9db9be7
buffer: refactor to use primordials instead of Array#reduce
aduh95 Dec 4, 2020
1091a65
test: fix bootstrap test
benjamingr Dec 6, 2020
a7e794d
test: fix flaky test-http2-respond-file-error-pipe-offset
Trott Nov 28, 2020
b39d150
test: fix comment misspellings of transferred
Trott Dec 3, 2020
197ba21
stream: support abort signal
benjamingr Nov 9, 2020
f73a0a8
lib: fix typo in internal/errors.js
RaisinTen Dec 7, 2020
a15addc
string_decoder: refactor to use more primordials
aduh95 Nov 21, 2020
cedf51f
http2: refactor to use more primordials
aduh95 Nov 21, 2020
c2938bd
lib: add uncurried accessor properties to `primordials`
ExE-Boss Nov 30, 2020
47345a1
worker: refactor to use more primordials
aduh95 Dec 4, 2020
9ae59c8
tools: upgrade to @babel/eslint-parser 7.12.1
aduh95 Nov 29, 2020
8611b8f
net: refactor to use more primordials
aduh95 Nov 17, 2020
5e5927e
2020-12-09, Version 15.4.0 (Current)
danielleadams Dec 7, 2020
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
Prev Previous commit
Next Next commit
tools: bump cpplint to 1.5.3
PR-URL: #36235
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
Trott authored and danielleadams committed Dec 7, 2020
commit bcf7393412fd8d240e5fcafec1303937e0676834
141 changes: 27 additions & 114 deletions tools/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
# if empty, use defaults
_valid_extensions = set([])

__VERSION__ = '1.5.2'
__VERSION__ = '1.5.3'

try:
xrange # Python 2
Expand Down Expand Up @@ -295,7 +295,6 @@
'build/include',
'build/include_subdir',
'build/include_alpha',
'build/include_inline',
'build/include_order',
'build/include_what_you_use',
'build/namespaces_headers',
Expand All @@ -311,13 +310,11 @@
'readability/constructors',
'readability/fn_size',
'readability/inheritance',
'readability/pointer_notation',
'readability/multiline_comment',
'readability/multiline_string',
'readability/namespace',
'readability/nolint',
'readability/nul',
'readability/null_usage',
'readability/strings',
'readability/todo',
'readability/utf8',
Expand All @@ -337,7 +334,6 @@
'runtime/string',
'runtime/threadsafe_fn',
'runtime/vlog',
'runtime/v8_persistent',
'whitespace/blank_line',
'whitespace/braces',
'whitespace/comma',
Expand All @@ -358,6 +354,13 @@
'whitespace/todo',
]

# keywords to use with --outputs which generate stdout for machine processing
_MACHINE_OUTPUTS = [
'junit',
'sed',
'gsed'
]

# These error categories are no longer enforced by cpplint, but for backwards-
# compatibility they may still appear in NOLINT comments.
_LEGACY_ERROR_CATEGORIES = [
Expand Down Expand Up @@ -839,14 +842,6 @@
'Missing space after ,': r's/,\([^ ]\)/, \1/g',
}

_NULL_TOKEN_PATTERN = re.compile(r'\bNULL\b')

_V8_PERSISTENT_PATTERN = re.compile(r'\bv8::Persistent\b')

_RIGHT_LEANING_POINTER_PATTERN = re.compile(r'[^=|(,\s><);&?:}]'
r'(?<!(sizeof|return))'
r'\s\*[a-zA-Z_][0-9a-zA-Z_]*')

_regexp_compile_cache = {}

# {str, set(int)}: a map from error categories to sets of linenumbers
Expand All @@ -866,7 +861,7 @@
# Files to exclude from linting. This is set by the --exclude flag.
_excludes = None

# Whether to suppress PrintInfo messages
# Whether to supress all PrintInfo messages, UNRELATED to --quiet flag
_quiet = False

# The allowed line length of files.
Expand Down Expand Up @@ -1087,11 +1082,10 @@ class _IncludeState(object):
# needs to move backwards, CheckNextIncludeOrder will raise an error.
_INITIAL_SECTION = 0
_MY_H_SECTION = 1
_OTHER_H_SECTION = 2
_OTHER_SYS_SECTION = 3
_C_SECTION = 4
_CPP_SECTION = 5

_C_SECTION = 2
_CPP_SECTION = 3
_OTHER_SYS_SECTION = 4
_OTHER_H_SECTION = 5

_TYPE_NAMES = {
_C_SYS_HEADER: 'C system header',
Expand Down Expand Up @@ -1357,7 +1351,9 @@ def PrintErrorCounts(self):
self.PrintInfo('Total errors found: %d\n' % self.error_count)

def PrintInfo(self, message):
if not _quiet and self.output_format != 'junit':
# _quiet does not represent --quiet flag.
# Hide infos from stdout to keep stdout pure for machine consumption
if not _quiet and self.output_format not in _MACHINE_OUTPUTS:
sys.stdout.write(message)

def PrintError(self, message):
Expand Down Expand Up @@ -2524,21 +2520,6 @@ def CheckForBadCharacters(filename, lines, error):
error(filename, linenum, 'readability/nul', 5, 'Line contains NUL byte.')


def CheckInlineHeader(filename, include_state, error):
"""Logs an error if both a header and its inline variant are included."""

all_headers = dict(item for sublist in include_state.include_list
for item in sublist)
bad_headers = set('%s.h' % name[:-6] for name in all_headers.keys()
if name.endswith('-inl.h'))
bad_headers &= set(all_headers.keys())

for name in bad_headers:
err = '%s includes both %s and %s-inl.h' % (filename, name, name)
linenum = all_headers[name]
error(filename, linenum, 'build/include_inline', 5, err)


def CheckForNewlineAtEOF(filename, lines, error):
"""Logs an error if there is no newline char at the end of the file.

Expand Down Expand Up @@ -3562,7 +3543,7 @@ def CheckForFunctionLengths(filename, clean_lines, linenum,
"""Reports for long function bodies.

For an overview why this is done, see:
https://google.github.io/styleguide/cppguide.html#Write_Short_Functions
https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions

Uses a simplistic algorithm assuming other style guidelines
(especially spacing) are followed.
Expand Down Expand Up @@ -4788,71 +4769,6 @@ def CheckAltTokens(filename, clean_lines, linenum, error):
'Use operator %s instead of %s' % (
_ALT_TOKEN_REPLACEMENT[match.group(1)], match.group(1)))

def CheckNullTokens(filename, clean_lines, linenum, error):
"""Check NULL usage.

Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found.
"""
line = clean_lines.elided[linenum]

# Avoid preprocessor lines
if Match(r'^\s*#', line):
return

if line.find('/*') >= 0 or line.find('*/') >= 0:
return

for match in _NULL_TOKEN_PATTERN.finditer(line):
error(filename, linenum, 'readability/null_usage', 2,
'Use nullptr instead of NULL')

def CheckV8PersistentTokens(filename, clean_lines, linenum, error):
"""Check v8::Persistent usage.

Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found.
"""
line = clean_lines.elided[linenum]

# Avoid preprocessor lines
if Match(r'^\s*#', line):
return

if line.find('/*') >= 0 or line.find('*/') >= 0:
return

for match in _V8_PERSISTENT_PATTERN.finditer(line):
error(filename, linenum, 'runtime/v8_persistent', 2,
'Use v8::Global instead of v8::Persistent')

def CheckLeftLeaningPointer(filename, clean_lines, linenum, error):
"""Check for left-leaning pointer placement.

Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found.
"""
line = clean_lines.elided[linenum]

# Avoid preprocessor lines
if Match(r'^\s*#', line):
return

if '/*' in line or '*/' in line:
return

for match in _RIGHT_LEANING_POINTER_PATTERN.finditer(line):
error(filename, linenum, 'readability/pointer_notation', 2,
'Use left leaning pointer instead of right leaning')

def GetLineWidth(line):
"""Determines the width of the line in column positions.
Expand Down Expand Up @@ -5007,9 +4923,6 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
CheckSpacingForFunctionCall(filename, clean_lines, linenum, error)
CheckCheck(filename, clean_lines, linenum, error)
CheckAltTokens(filename, clean_lines, linenum, error)
CheckNullTokens(filename, clean_lines, linenum, error)
CheckV8PersistentTokens(filename, clean_lines, linenum, error)
CheckLeftLeaningPointer(filename, clean_lines, linenum, error)
classinfo = nesting_state.InnermostClass()
if classinfo:
CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error)
Expand Down Expand Up @@ -5195,10 +5108,11 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
include_state.include_list[-1].append((include, linenum))

# We want to ensure that headers appear in the right order:
# 1) for foo.cc, foo.h
# 2) other project headers
# 3) c system files
# 4) cpp system files
# 1) for foo.cc, foo.h (preferred location)
# 2) c system files
# 3) cpp system files
# 4) for foo.cc, foo.h (deprecated location)
# 5) other google headers
#
# We classify each include statement as one of those 5 types
# using a number of techniques. The include_state object keeps
Expand Down Expand Up @@ -5461,7 +5375,7 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension,
and line[-1] != '\\'):
error(filename, linenum, 'build/namespaces_headers', 4,
'Do not use unnamed namespaces in header files. See '
'https://google.github.io/styleguide/cppguide.html#Namespaces'
'https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Namespaces'
' for more information.')


Expand Down Expand Up @@ -6583,8 +6497,6 @@ def ProcessFileData(filename, file_extension, lines, error,

CheckForNewlineAtEOF(filename, lines, error)

CheckInlineHeader(filename, include_state, error)

def ProcessConfigOverrides(filename):
""" Loads the configuration files and processes the config overrides.

Expand All @@ -6603,7 +6515,7 @@ def ProcessConfigOverrides(filename):
if not base_name:
break # Reached the root directory.

cfg_file = os.path.join(abs_path, ".cpplint")
cfg_file = os.path.join(abs_path, "CPPLINT.cfg")
abs_filename = abs_path
if not os.path.isfile(cfg_file):
continue
Expand Down Expand Up @@ -6840,9 +6752,9 @@ def ParseArguments(args):
if opt == '--version':
PrintVersion()
elif opt == '--output':
if val not in ('emacs', 'vs7', 'eclipse', 'junit'):
if val not in ('emacs', 'vs7', 'eclipse', 'junit', 'sed', 'gsed'):
PrintUsage('The only allowed output formats are emacs, vs7, eclipse '
'and junit.')
'sed, gsed and junit.')
output_format = val
elif opt == '--quiet':
quiet = True
Expand Down Expand Up @@ -6985,3 +6897,4 @@ def main():

if __name__ == '__main__':
main()