electron/script/cpplint.py

46 строки
1.3 KiB
Python
Исходник Обычный вид История

2013-06-24 13:03:48 +04:00
#!/usr/bin/env python
import fnmatch
import os
import sys
from lib.util import execute
2013-08-13 13:07:36 +04:00
IGNORE_FILES = [
2014-04-15 11:42:46 +04:00
os.path.join('atom', 'browser', 'mac', 'atom_application.h'),
os.path.join('atom', 'browser', 'mac', 'atom_application_delegate.h'),
2014-03-16 04:58:59 +04:00
os.path.join('atom', 'browser', 'resources', 'win', 'resource.h'),
os.path.join('atom', 'browser', 'ui', 'cocoa', 'atom_menu_controller.h'),
os.path.join('atom', 'common', 'api', 'api_messages.h'),
2014-08-21 16:25:12 +04:00
os.path.join('atom', 'common', 'common_message_generator.cc'),
os.path.join('atom', 'common', 'common_message_generator.h'),
2013-06-24 13:03:48 +04:00
]
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
2013-06-24 13:03:48 +04:00
def main():
os.chdir(SOURCE_ROOT)
2016-01-20 17:11:28 +03:00
files = list_files(['app', 'browser', 'common', 'renderer', 'utility'],
2013-06-24 13:03:48 +04:00
['*.cc', '*.h'])
2013-08-13 13:07:36 +04:00
call_cpplint(list(set(files) - set(IGNORE_FILES)))
2013-06-24 13:03:48 +04:00
def list_files(directories, filters):
matches = []
for directory in directories:
2014-03-16 04:58:59 +04:00
for root, _, filenames, in os.walk(os.path.join('atom', directory)):
2013-06-24 13:03:48 +04:00
for f in filters:
for filename in fnmatch.filter(filenames, f):
matches.append(os.path.join(root, filename))
return matches
def call_cpplint(files):
cpplint = os.path.join(SOURCE_ROOT, 'vendor', 'depot_tools', 'cpplint.py')
execute([sys.executable, cpplint] + files)
2013-06-24 13:03:48 +04:00
if __name__ == '__main__':
sys.exit(main())