| #!/usr/bin/env python3 |
| # -*- coding: utf-8 -*- |
| # Copyright 2018 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| """Simpler helper to run cpplint on source files.""" |
| |
| from __future__ import print_function |
| |
| import glob |
| import os |
| import sys |
| |
| import ssh_client |
| |
| |
| def main(argv): |
| """The main func!""" |
| # We don't parse argv on purpose -- pass everything down to cpplint. |
| if not argv: |
| os.chdir(ssh_client.DIR) |
| argv = [] |
| for subdir in ('src', os.path.join('wassh-libc-sup', 'include'), |
| os.path.join('wassh-libc-sup', 'include', 'sys'), |
| os.path.join('wassh-libc-sup', 'src')): |
| argv += glob.glob(os.path.join(subdir, '*.cc')) |
| argv += glob.glob(os.path.join(subdir, '*.[ch]')) |
| |
| # TODO: Should prob sort out the /int and /casting warnings. |
| cmd = ['cpplint.py', |
| '--extensions=cc,c,h,hpp,cpp', |
| ('--filter=-build/header_guard,-build/include,-runtime/int,' |
| '-readability/casting,-readability/todo')] + argv |
| |
| os.execvp(cmd[0], cmd) |
| |
| |
| if __name__ == '__main__': |
| sys.exit(main(sys.argv[1:])) |