CppLint changes for VSCode cpplint plugin

This patch makes some changes to the cpplint.py script for integration
with the VSCode cpplint plugin, available here:

https://marketplace.visualstudio.com/items?itemName=mine.cpplint

Specifically, the "--repository" and "--headers" options currently cause
our version of cpplint to crash, when we should at worst ignore them. A
minor messaging tweak outputting the contents of the GetoptError, to
make debugging input argument bugs easier, is included

Change-Id: Id78616f5e2fdecb7da650042f0658623477ef9cb
Reviewed-on: https://chromium-review.googlesource.com/c/1481938
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Jordan Bayles <jophba@chromium.org>
changes/38/1481938/2
Jordan Bayles 6 years ago committed by Commit Bot
parent ac0cb2c114
commit 91a32c5e39

10
cpplint.py vendored

@ -6004,14 +6004,16 @@ def ParseArguments(args):
"""
try:
(opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose=',
'headers=', # We understand but ignore headers.
'counting=',
'filter=',
'root=',
'linelength=',
'extensions=',
'project_root='])
except getopt.GetoptError:
PrintUsage('Invalid arguments.')
'project_root=',
'repository='])
except getopt.GetoptError as e:
PrintUsage('Invalid arguments: {}'.format(e))
verbosity = _VerboseLevel()
output_format = _OutputFormat()
@ -6038,7 +6040,7 @@ def ParseArguments(args):
elif opt == '--root':
global _root
_root = val
elif opt == '--project_root':
elif opt == '--project_root' or opt == "--repository":
global _project_root
_project_root = val
if not os.path.isabs(_project_root):

Loading…
Cancel
Save