electron/brightray/script/cpplint
2017-03-23 10:08:25 -07:00

40 lines
1.1 KiB
Python
Executable file

#!/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', 'libchromiumcontent', 'vendor', 'depot_tools', 'cpplint.py')
IGNORED_FILES = [
os.path.join('browser', 'mac', 'bry_inspectable_web_contents_view.h'),
os.path.join('browser', 'mac', 'event_dispatching_window.h'),
os.path.join('browser', 'mac', 'notification_center_delegate.h'),
]
def main():
os.chdir(SOURCE_ROOT)
files = list_files(['browser', 'common'],
['*.cc', '*.h'])
return cpplint(set(files) - set(IGNORED_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):
return subprocess.call([sys.executable, CPPLINT] + list(files))
if __name__ == '__main__':
sys.exit(main())