2013-06-24 13:03:48 +04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import fnmatch
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
2013-08-13 13:07:36 +04:00
|
|
|
IGNORE_FILES = [
|
2014-02-26 17:51:37 +04:00
|
|
|
os.path.join('browser', 'atom_application_mac.h'),
|
|
|
|
os.path.join('browser', 'atom_application_delegate_mac.h'),
|
|
|
|
os.path.join('browser', 'native_window_mac.h'),
|
|
|
|
os.path.join('browser', 'resources', 'win', 'resource.h'),
|
|
|
|
os.path.join('browser', 'ui', 'cocoa', 'event_processing_window.h'),
|
|
|
|
os.path.join('browser', 'ui', 'cocoa', 'atom_menu_controller.h'),
|
|
|
|
os.path.join('browser', 'ui', 'cocoa', 'nsalert_synchronous_sheet.h'),
|
|
|
|
os.path.join('browser', 'ui', 'gtk', 'gtk_custom_menu.cc'),
|
|
|
|
os.path.join('browser', 'ui', 'gtk', 'gtk_custom_menu_item.cc'),
|
|
|
|
os.path.join('common', 'api', 'api_messages.cc'),
|
|
|
|
os.path.join('common', 'api', 'api_messages.h'),
|
|
|
|
os.path.join('common', 'atom_version.h'),
|
|
|
|
os.path.join('common', 'swap_or_assign.h'),
|
2013-06-24 13:03:48 +04: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 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:
|
2013-09-27 06:21:27 +04:00
|
|
|
for root, _, filenames, in os.walk(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):
|
2013-07-07 12:25:50 +04:00
|
|
|
cpplint = os.path.join(SOURCE_ROOT, 'vendor', 'depot_tools', 'cpplint.py')
|
2013-06-24 13:03:48 +04:00
|
|
|
rules = '--filter=-build/header_guard,-build/include_what_you_use'
|
2013-08-21 17:35:41 +04:00
|
|
|
subprocess.check_call([sys.executable, cpplint, rules] + files)
|
2013-06-24 13:03:48 +04:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|