2013-06-24 09:03:48 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import fnmatch
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
2013-08-13 09:07:36 +00:00
|
|
|
IGNORE_FILES = [
|
2013-07-07 08:25:50 +00:00
|
|
|
'app/win/resource.h',
|
2013-06-24 09:03:48 +00:00
|
|
|
'browser/atom_event_processing_window.h',
|
|
|
|
'browser/atom_application_mac.h',
|
|
|
|
'browser/atom_application_delegate_mac.h',
|
|
|
|
'browser/native_window_mac.h',
|
2013-08-17 08:28:06 +00:00
|
|
|
'browser/ui/atom_menu_controller_mac.h',
|
2013-08-13 09:07:36 +00:00
|
|
|
'browser/ui/nsalert_synchronous_sheet_mac.h',
|
2013-06-24 09:03:48 +00:00
|
|
|
'common/api/api_messages.cc',
|
|
|
|
'common/api/api_messages.h',
|
2013-08-13 09:07:36 +00:00
|
|
|
'common/atom_version.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:
|
|
|
|
for root, dirs, 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 call_cpplint(files):
|
2013-07-07 08:25:50 +00:00
|
|
|
cpplint = os.path.join(SOURCE_ROOT, 'vendor', 'depot_tools', 'cpplint.py')
|
2013-06-24 09:03:48 +00:00
|
|
|
rules = '--filter=-build/header_guard,-build/include_what_you_use'
|
|
|
|
subprocess.call([sys.executable, cpplint, rules] + files)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|