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>
diff --git a/cpplint.py b/cpplint.py
index 8a85c9e..04b99cb 100755
--- a/cpplint.py
+++ b/cpplint.py
@@ -6004,14 +6004,16 @@
"""
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 @@
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):