Skip to content
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

tools: bump cpplint to 1.5.3 #36235

Merged
merged 2 commits into from
Nov 26, 2020
Merged
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
19 changes: 14 additions & 5 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 @@ -358,6 +358,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 @@ -866,7 +873,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 @@ -1357,7 +1364,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 @@ -6840,9 +6849,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