2013-11-17 22:36:57 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import fnmatch
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|
|
|
CPPLINT = os.path.join(SOURCE_ROOT, 'vendor', 'google-styleguide', 'trunk', 'cpplint', 'cpplint.py')
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
os.chdir(SOURCE_ROOT)
|
|
|
|
files = list_files(['browser', 'common'],
|
|
|
|
['*.cc', '*.mm', '*.h'])
|
|
|
|
return cpplint(files)
|
|
|
|
|
|
|
|
|
|
|
|
def list_files(directories, filters):
|
|
|
|
matches = []
|
|
|
|
for directory in directories:
|
|
|
|
for root, _, filenames, in os.walk(directory):
|
|
|
|
for f in filters:
|
|
|
|
for filename in fnmatch.filter(filenames, f):
|
|
|
|
matches.append(os.path.join(root, filename))
|
|
|
|
return matches
|
|
|
|
|
|
|
|
|
|
|
|
def cpplint(files):
|
2013-11-17 22:51:49 +00:00
|
|
|
rules = '--filter=-build/header_guard,-legal/copyright'
|
2013-11-17 22:36:57 +00:00
|
|
|
return subprocess.call([sys.executable, CPPLINT, rules] + files)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|