2013-06-24 09:03:48 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import fnmatch
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2014-02-26 14:08:01 +00:00
|
|
|
from lib.util import execute
|
|
|
|
|
2013-08-13 09:07:36 +00:00
|
|
|
IGNORE_FILES = [
|
2014-03-16 01:13:06 +00:00
|
|
|
os.path.join('atom', 'app', 'atom_main.cc'),
|
2014-04-15 07:42:46 +00:00
|
|
|
os.path.join('atom', 'browser', 'mac', 'atom_application.h'),
|
|
|
|
os.path.join('atom', 'browser', 'mac', 'atom_application_delegate.h'),
|
2014-03-16 00:58:59 +00:00
|
|
|
os.path.join('atom', 'browser', 'native_window_mac.h'),
|
|
|
|
os.path.join('atom', 'browser', 'resources', 'win', 'resource.h'),
|
|
|
|
os.path.join('atom', 'browser', 'ui', 'cocoa', 'event_processing_window.h'),
|
|
|
|
os.path.join('atom', 'browser', 'ui', 'cocoa', 'atom_menu_controller.h'),
|
|
|
|
os.path.join('atom', 'browser', 'ui', 'gtk', 'gtk_custom_menu.cc'),
|
|
|
|
os.path.join('atom', 'browser', 'ui', 'gtk', 'gtk_custom_menu_item.cc'),
|
|
|
|
os.path.join('atom', 'common', 'api', 'api_messages.cc'),
|
|
|
|
os.path.join('atom', 'common', 'api', 'api_messages.h'),
|
|
|
|
os.path.join('atom', 'common', 'api', 'atom_extensions.h'),
|
|
|
|
os.path.join('atom', 'common', 'atom_version.h'),
|
|
|
|
os.path.join('atom', 'common', 'swap_or_assign.h'),
|
2013-06-24 09:03:48 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
os.chdir(SOURCE_ROOT)
|
|
|
|
files = list_files(['app', 'browser', 'common', 'renderer'],
|
|
|
|
['*.cc', '*.h'])
|
2013-08-13 09:07:36 +00:00
|
|
|
call_cpplint(list(set(files) - set(IGNORE_FILES)))
|
2013-06-24 09:03:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
def list_files(directories, filters):
|
|
|
|
matches = []
|
|
|
|
for directory in directories:
|
2014-03-16 00:58:59 +00:00
|
|
|
for root, _, filenames, in os.walk(os.path.join('atom', directory)):
|
2013-06-24 09:03:48 +00: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):
|
2013-07-07 08:25:50 +00:00
|
|
|
cpplint = os.path.join(SOURCE_ROOT, 'vendor', 'depot_tools', 'cpplint.py')
|
2014-03-16 01:13:06 +00:00
|
|
|
execute([sys.executable, cpplint] + files)
|
2013-06-24 09:03:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|